DefaultLegacyOpener: indicate how image was opened

If we open an ImagePlus, we will now set the "Info" property with
information about what version of SCIFIO was used, and what format was
used to open the dataset.
IJ1Helper: avoid duplicating recent list

If the item was the most recently used (at index 0), it was added again,
bumping the last item off the list.

Instead, we want to do nothing if it's already the most recently used,
move the item if it's on the list, and replace the oldest item if the
new item was not on the list.
Register ij.ImagePlus alias with the ScriptService

This allows parameters to be written using shorthand; e.g.:

   // @ImagePlus imp

As opposed to needing to write:

   // @ij.ImagePlus imp
Bump to pom-imagej 2.20

Updates to the latest pom-imagej.
DefaultLegacyOpener: use Metadata.getFormatName

We can now use the Metadata's FormatName instead of the Format's. This
is more precise and allows reflection of runtime state.
Remove unused import

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Make really, really sure that ImageJ 1.x is initialized before use

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Accomodate legacy command-line needs in the IJ1Helper

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Handle legacy command-line arguments

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Handle -batch as last argument

When -batch is passed as last command-line argument, the *complete*
process is supposed to be in batch mode.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Work around already-initialized instance in batch mode

When ImageJ is called via the command-line

	ImageJ -eval ... -batch

*without* the --headless option, the LegacyUI already constructed
an ImageJ 1.x frame. As a consequence, all output will go to
a text window despite the user having asked for batch execution.

We work around that by tearing down the instance when encountering
the -batch argument.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Use the context class loader for the legacy environment

We cannot be sure that the class loader to be used is the exact class
loader that loaded imagej-legacy. A child of that class loader might be
desired, e.g. to add paths for additional ImageJ 1.x plugins.

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

The commandsTable *should* be initialized. But it might not be...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Let the ij1Helper dispose of the LegacyUI

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Show the full version even in the LegacyUI

This allows us to show the ImageJ2 version along with the legacy version.

As a consequence, we have to access the static version directly in the
IJ1Helper to avoid an infinite recursion between IJ.getVersion() and
legacyService.getLegacyVersion().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Force the initial LegacyUI status bar to show the correct version

The "correct version" being, of course, the full ImageJ2 version
including the legacy version.

This is not possible otherwise because the legacy hooks can only
be replaced with a DefaultLegacyHooks instance once ImageJ 1.x is
fully initialized, which is unfortunately *after* ImageJ 1.x
wants to report its version.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge branch 'legacy-cmdline-options'

This topic branch adds back support for ImageJ 1.x command line
options such as '-eval ...' and '-batch ...'. The primary purpose
of doing this is to allow Fiji to switch from its own Main class
to using straight net.imagej.Main.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge 'legacy-version' into HEAD