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