Add an icon for a script

As before, the icon is taked from the Silk icons:

	http://www.famfamfam.com/lab/icons/silk/

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

The purpose of this class is -- similar to the legacy plugin finder -- to
look through ImageJ.app/plugins/ and find all the scripts. Those scripts
will be added to the Plugins menu (or submenu, corresponding to the
subdirectory where the scripts were found). All the hard work is handed
off to the ScriptPlugin class.

Like in Fiji, the directory ImageJ.app/plugins/Scripts/ is special in that
the scripts will be pulled up into the top-level menu structure, e.g.
ImageJ.app/plugins/Scripts/File/Fetch.js will be available as File>Fetch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the annotation for discovering script languages

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Initial version of the ScriptService

This service's purpose is to discover script language implementations and
provide some convenience functions to work with them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add abstract base classes for ScriptEngine and ScriptEngineFactory

We will need only a fraction of the functionality offered by Java's
Scripting support.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
AbstractScriptEngineFactory: make the class name the default language name

... and also the default engine name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ScriptService: discover and add javax.scripting engines

In the future, we will add more interfaces for the Script interpreters
which the javax.scripting engines do not support, such as letting us
redirect input/output, support single-stepping and breakpoints and
importing classes/packages by default. But these are just capabilities we
will add using duck-typing, and the javax.scripting engines simply will
not support those capabilities.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ScriptService: add isFileHandled(file) method

It is often useful to be able to test whether a given file could be
executed without executing it just yet.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ScriptFinder: use ScriptService's isFileHandled() method

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ScriptPlugin: catch all Throwables, not just ScriptException

There is no default display for exceptions, so let's make extra sure that
the user is notified of problems.

While at it, show only the target exception for ScriptExceptions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the top-level 'script' project with the 'script-beanshell' child

This commit may serve as example what it takes to add other Script
languages in the future.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the Beanshell scripting adapter

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Really look only in the plugins/ directory for scripts

Really look only in the plugins/ directory for scripts

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ScriptFinder: log how many scripts were found

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
In scripts' menu items, replace underscores and extensions

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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>