Let LineOutputStream#println(String) throw an IOException

This is really needed for errors in the backend.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CheckSezpozTest: clean up after the test

... so that subsequent tests do not have problems by not finding the
Annotated class.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
UpdaterTest: record more information for intermittently failing test

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Updater: make ij.dir detection more robust

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
UpdaterTest: do not trust .checksums

We're writing out files way too fast for .checksums to be correct all
the time (it checksums and timestamps, the latter with whole-second
precision, so it is highly likely that our test writes out files
which are then not picked up as modified.

We already handled that problem by deleting the .checksums file before
running the checksummer, but in the process of introducing
FilesCollection#downloadIndexAndChecksum(Progress) a conditional case was
introduced where this developer forgot to add the .checksums deletion
again.

This commit fixes that oversight.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
UpdaterTest: fix a thinko

This bug was introduced in e9171c47(UpdaterTest: make a few methods
work on secondary ijRoots), but hidden by the bug fixed in the
previous commit.

Together, these two bugs caused a few intermittent test failures with
Jennifer Jenkins.

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

These will be discovered by the upcoming script service. Script
languages which are not added via Java 1.6' scripting framework need to
implement this interface so that ImageJ2 discovers them.

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 canHandleFile(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 canHandleFile() method

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

As in Fiji, we only want to handle scripts that are in the plugins/
directory.

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: add eval(name, reader)

Not always do we want to run scripts which are stored in files;
allowing to execute scripts from InputStreams adds the option to run
scripts from Strings via a StringReader.

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>
ScriptPlugin: avoid using the deprecated Log class

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