Add a stub for the macro interpreter

For the moment, only getDimensions() is implemented. But it is a proof of
concept: this function disagrees with the syntax of most Java/C-like
languages as it does not use the values of the passed parameters, but
rather the variable names. It does not even complain when the variables
were not defined previously.

With that task done we will now implement all of the macro language's
built-in functions in the class imagej.script.MacroFunctions.

Of course, the way we do it will also give plugin programmers all the
macro functions for free, something which was not possible with IJ1.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
IJ_Macro: make sure javassist knows where Beanshell lives

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Start to implement macro functions

For the moment, most of the functions are stubs throwing Exceptions, but
the math-related functions are already implemented.

As a proof of concept, bitDepth() is also implemented.

For errors such as when there is no current image, but the currently
executed function requires one, it is nicer to tell the user what is
happening, so we also introduce a new exception, MacroException.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Implement a few more macro functions

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
wip: Implement the mouse & keyboard related macro functions

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Service: allow setting the file name and stdout & stderr

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
TODO: Scripting: add a tag for compiled languages

This interface serves as a duct-typing-interface to label
ScriptEngineFactory implementations to tell ImageJ2 that the language
actually needs compilation prior to execution.

It might still require a companion interface (to be done in the future)
for ScriptEngine to add the compile() method returning a list of compile
products. But maybe it is enough to add that method to CompiledLanguage;
we will see when porting Refresh_Javas to ImageJ2 ;-)

Note: the ScriptEngineFactory must be labeled so that e.g. the Script
Editor can decide even without a ScriptEngine instance that there need to
be different labels in the Run menu (Compile and Run, as opposed to Run).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the ij-ui-script-editor project

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
First code dump of the Fiji Script Editor

This dump is intentionally non-compiling, to offer a better base for
concurrent development of the Script Editor.

The base is fiji.git's commit fc077481.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: remove now-obsolete classes

These classes were needed in the context of Fiji and/or IJ1.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: the classes are now in package imagej.script.editor

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: add copyright headers

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: massive cleanup to make it compile

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Make the Script Editor a proper plugin

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: use AppUtils.getBaseDirectory() everywhere

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: use the File class more consistently

While at it, refrain from using an AWT file dialog ;-)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: make sure that annotation processing is enabled

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: remove discardAllEdits()

It is doubtful whether all editor components will support this.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: rename the TextEditor class into EditorFrame

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Editor: refactor the Executer class out of EditorFrame

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>