-
Notifications
You must be signed in to change notification settings - Fork 53
Description
As discussed in imagej/imagej-common#71, it would be nice to have a Load from file... option whenever we show a choice dropdown for arbitrary objects (including, but not limited to, images) via the ObjectWidget
.
This can possibly be achieved by adding an additional object during the discovery of valid choices here:
scijava-common/src/main/java/org/scijava/widget/AbstractInputHarvester.java
Lines 131 to 139 in 560ad96
/** Asks the object service and convert service for valid choices */ | |
@SuppressWarnings("unchecked") | |
private List<?> getObjects(final Class<?> type) { | |
@SuppressWarnings("rawtypes") | |
List compatibleInputs = | |
new ArrayList(convertService.getCompatibleInputs(type)); | |
compatibleInputs.addAll(objectService.getObjects(type)); | |
return compatibleInputs; | |
} |
We should display this option whenever we find an IOPlugin
that can open objects of the target type, or convertible to the target type.
How can this be achieved? Maybe a custom converter File
-> anything that provides a suitable IOPlugin
, but converters have to provide a specific output type, right? Maybe a custom implementation in ObjectWidget
/AbstractInputHarvester
is required?
Also, how can we achieve that uiService.chooseFile()
is called (and the file is loaded) only when the input is actually selected and the module processed? Do we have to intercept the ModuleItem#setValue()
call, or can we do this with a custom PreprocessorPlugin
?
(Just writing down some thoughts, before I forget.)