Skip to content

Commit 86f29b4

Browse files
committed
ModuleService#getSingleInput: skip unfillable inputs
If an input is unfillable (i.e., the ModuleItem's isAutoFill method returns false), then it is intended that preprocessors not fill in the input with any sort of preset or "active" data value. For example, the ActiveDisplayPreprocessor should not fill in a Display input with the active display if that input is marked autoFill=false. This fixes a longstanding bug with the Active*Preprocessor classes, which made it impossible to exclude inputs from being handled by them. Fixes http://trac.imagej.net/ticket/2022.
1 parent 0693a81 commit 86f29b4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/main/java/org/scijava/module/DefaultModuleService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ private <T> ModuleItem<T> getSingleItem(final Module module,
374374
final String name = item.getName();
375375
final boolean resolved = module.isResolved(name);
376376
if (resolved) continue; // skip resolved inputs
377+
if (!item.isAutoFill()) continue; // skip unfillable inputs
377378
if (!type.isAssignableFrom(item.getType())) continue;
378379
if (result != null) return null; // multiple matching items
379380
@SuppressWarnings("unchecked")

src/main/java/org/scijava/module/ModuleService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ <M extends Module> Future<M> run(M module,
260260
<M extends Module> M waitFor(Future<M> future);
261261

262262
/**
263-
* Checks the given module for a solitary unresolved input of the given type,
264-
* returning the relevant {@link ModuleItem} if found, or null if not exactly
265-
* one unresolved input of that type.
263+
* Checks the given module for a solitary unresolved fillable input of the
264+
* given type, returning the relevant {@link ModuleItem} if found, or null if
265+
* not exactly one unresolved fillable input of that type.
266266
*/
267267
<T> ModuleItem<T> getSingleInput(Module module, Class<T> type);
268268

0 commit comments

Comments
 (0)