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 annotation for discovering script languages

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>
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>
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>
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>
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: 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 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>
AbstractScriptEngine: implement engine scope bindings

This will be needed to support proper file attributions for stack traces.

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>
AbstractEngine: factor out the minimal bindings, add script context

We need the script context, unfortunately, in order to redirect readers
and writers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Scripting: add a Writer-to-OutputStream adapter

At least Beanshell wants to write to an PrintStream instead of a writer...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Script Service: offer an API to set file name and stdout/stderr

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>