Add the user-interface independent part of a generic script interpreter#127
Conversation
|
There is an open problem with this PR, still: command histories are not persisted correctly. To test this, start the |
|
Also, it looks like before this can be merged, the changes to |
Once the test ran successfully, bar is distinctively different from 0... Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The most generic way to provide a bunch of Strings to persist is by passing an Iterable<String> for writing and handling an Iterable<String> when reading. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The problem was actually in the |
This is similar to the LinkedHashMap structure, except that an already-existing item can be easily put to the front of the list, or the back. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The newly-introduced History class maintains the history of most recently executed statements and has functionality to persist and retrieve the list from the preferences. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The newly-introduced ScriptInterpreter class provides all the functionality of a script interpreter sans the graphical user interface. It can execute statements and persists a history of most recently executed statements. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
It simplifies things downstream to be able to query the associated ScriptLanguage later, since it is known at construction time anyway. This does *not* persist the most recently used interpreter language!
The 'current command' is the command that is not yet in the history. It is very convenient to be able to go back in history, just to have a look, before continuing to craft the current command (and it would be annoying if it was lost when going back in history). Of course, if the user decides to execute a different command from the history instead, the edits to the 'current command' are lost. This behavior is most in line with the Unix shell behavior power users might be used to. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the user-interface independent part of a generic script interpreter
|
yay! |
Fiji introduced interpreters for the script languages it supported. When ImageJ2 overhauled the idea of Fiji's scripting framework, reimplementing it cleanly on top of the SciJava common framework, the interpreters were dropped due to a misconception how widely in use they are. For example, Pavel Tomancak – the father of Fiji – pointed out that he uses the interpreter quite heavily.
Therefore, let's introduce a clean rewrite of the script interpreters. This topic branch adds the backend that is not visible to users; a corresponding Pull Request will be opened in the
imagej-ui-swingproject in a moment.