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
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.)