Skip to content

Commit 581301f

Browse files
committed
Correct preprocessor priorities
The LoadInputsPreprocessor needs to run before FilePreprocessor. If it does not, the FilePreprocessor will pop a file chooser dialog and one of two things will happen: * a file path will be selected * the command will be canceled In the latter case, the LoadInputsPreprocessor does not run. In the former, the file path has been resolved already and any persisted value is irrelevant. Both of these preprocessors were at Low priority + 1, basically because they wanted to run before the InputHarvester. Thus their priorities have been updated to InputHarvester.PRIORITY + 1 (LoadInputs) and + 0.5 (File) to ensure they execute in the correct order.
1 parent a96c4e5 commit 581301f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/org/scijava/module/process/LoadInputsPreprocessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131

3232
package org.scijava.module.process;
3333

34-
import org.scijava.Priority;
3534
import org.scijava.module.Module;
3635
import org.scijava.module.ModuleItem;
3736
import org.scijava.plugin.Plugin;
3837
import org.scijava.util.ConversionUtils;
38+
import org.scijava.widget.InputHarvester;
3939

4040
/**
4141
* A preprocessor for loading populated input values from persistent storage.
@@ -49,7 +49,7 @@
4949
* @author Curtis Rueden
5050
*/
5151
@Plugin(type = PreprocessorPlugin.class,
52-
priority = Priority.VERY_LOW_PRIORITY + 1)
52+
priority = InputHarvester.PRIORITY + 1)
5353
public class LoadInputsPreprocessor extends AbstractPreprocessorPlugin {
5454

5555
// -- ModuleProcessor methods --

src/main/java/org/scijava/ui/FilePreprocessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333

3434
import java.io.File;
3535

36-
import org.scijava.Priority;
3736
import org.scijava.module.Module;
3837
import org.scijava.module.ModuleItem;
3938
import org.scijava.module.process.AbstractPreprocessorPlugin;
4039
import org.scijava.module.process.PreprocessorPlugin;
4140
import org.scijava.plugin.Parameter;
4241
import org.scijava.plugin.Plugin;
42+
import org.scijava.widget.InputHarvester;
4343

4444
/**
4545
* A preprocessor plugin that handles single unresolved parameters of type
@@ -49,7 +49,7 @@
4949
* @see UserInterface#chooseFile(File, String)
5050
*/
5151
@Plugin(type = PreprocessorPlugin.class,
52-
priority = Priority.VERY_LOW_PRIORITY + 1)
52+
priority = InputHarvester.PRIORITY + 0.5)
5353
public class FilePreprocessor extends AbstractPreprocessorPlugin {
5454

5555
@Parameter(required = false)

0 commit comments

Comments
 (0)