knime-ip / knip-scripting

KNIP Scripting Extension based on SciJava-Scripting
3 stars 0 forks source link

Improvements to Java Scripting Node #4

Closed Squareys closed 9 years ago

Squareys commented 9 years ago

With #1 complete, we have a fully functional, but hard to use Java Scripting Node.

The following improvements are needed:

ctrueden commented 9 years ago

Were you able to reuse any of the Script Editor components from imagej-ui-swing? It would be really great if we could create a single "SciJava script editor" that both KNIME and ImageJ (and others) could use for rich editing of source code!

Squareys commented 9 years ago

Up till now I used RSyntaxArea (which is a superclass of the ImageJ Editor anyway). We are bound by the limitations of the Node Dialogs in KNIME, so menus for example will propably not be useable. It would be awesome, if we could use at least the text editor component of the Script Editor, since that would provide Syntax highlighting for all the languages. And, since the editor pane is a subclass of RSyntaxArea, we can easily implement the autocompletion aswell.

It should be rather simple to replace the current editor with the ImageJ editor pane.

ctrueden commented 9 years ago

Great, I appreciate your diligence on the matter, @Squareys. Reusing each others' code is worth the extra effort. Feel free to file issues and/or PRs against imagej-ui-swing—or we could even split out the Script Editor to its own artifact if that helps you.

Squareys commented 9 years ago

EditorPane is currently very tightly coupled with the TextEditor. I will try to loosen this a bit to be able to use the EditorPane without TextEditor. I might also create some Interfaces which will hopefully make more features of the ScriptEditor implementable in the ScriptingNode Dialog.

EDIT - That is not completely true, one can pass null for the parent TextEditor, there are checks for that everywhere, so that the EditorPane could function without.

ctrueden commented 9 years ago

Sounds good. The imagej-ui-swing component is still at 0.x version, so feel free to break backwards compatibility of the Script Editor API, if it helps. And actually, we should ultimately migrate it to scijava-ui-swing instead, or maybe a totally separate component.

dietzc commented 9 years ago

one more improvements include: allow choosing how output columns are handled: append to table, new table with only the output columns, each column may replace another one.

Squareys commented 9 years ago

Okay. Isn't there something already existing I can use here?

dietzc commented 9 years ago

Sure. The mechanism we implemented in the ValueToCellNodeModel, the ColumnRearranger. Anyway, it's not too obvious how to get this into the GUI of the scripting node, as it is an per output configuration (append/replace) or a global configuration (new table). But I'm sure you will figure something out ;-)

Squareys commented 9 years ago

@dietzc If there was a "n:1 rows" execution mode of the script, or "1:n rows" for that matter, a completely new table would unavoidable, correct? So we should let the user choose between input rows == output rows (automatic row creation) and input rows != output rows (manual row creation over OutputTableService Parameter)

Or even better: autodetect if the script code contains any call to KnimeOutputDataTableService.appendRow, since the user could inappropriately set automatic row creation. (This would not cover the n:1 case though)

Squareys commented 9 years ago

I just rearranged the NodeDialog (see 235bfa7e338f360df7fda00fba47eefc3effd8e). The code completion will wait until I have the ImageJ script editor integrated instead of the current plain RSyntaxTextArea.

Squareys commented 9 years ago

All of this is done. Autocompletion via the ImageJ script editor, which is now integrated. The script is also now written to a file before compilation.