Move some code from the LegacyInitializer to the IJ1Helper

The current strategy for the legacy mode is to let fiji.Main create
a LegacyEnvironment that patches an encapsulated ImageJ 1.x-only
ClassLoader which in turn creates a PluginClassLoader in which the
LegacyInitializer is called to spin up the ImageJ2 context.

In that setting, it does not matter whether the IJ1Helper (initialized
by the DefaultLegacyService) or whether the LegacyInitializer calls the
code to initialize context class loader, icon and application title.

However, our plan is to let the DefaultLegacyService spin up ImageJ
1.x; In that scenario, the LegacyInitializer is no longer called,
but the IJ1Helper is.

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

This file was copied from scripting-java, which has a *slightly*
different license header (although the same type of license: BSD-2).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a TestDrive for the editor in legacy mode

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Bump the parent version preemptively

This is needed for the upcoming changes in support for the script editor
as well as for ImageJ2 starting up with the legacy UI as default UI.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a legacy default importer for the script editor

This plugin is responsible for listing the ImageJ 1.x and TrakEM2
classes (insofar available) in support of the auto-import feature of
the script editor.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a method to IJ1Helper to evaluate macros

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Avoid auto-importing non-public classes

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add script editor templates from Fiji's Script Editor

With ImageJ2's script editor, every component can ship their own
templates simply by bundling things in the /script-editor/ directory
of the .jar file. To provide everything needed for Fiji to switch
to the new script editor, imagej-legacy needs to take custody of the
templates for use with the legacy ImageJ 1.x classes.

This commit brings a verbatim copy of the templates from Fiji's
Script Editor. In the next commits, we will work on them more.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add an almost JSR-223-compliant script engine for ImageJ 1.x macros

This is a crucial building block to allow Fiji to switch over to ImageJ2's
script editor: Fiji *needs* to support ImageJ 1.x macros in the script
editor, otherwise users will actually say something.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
No need to auto-import java.lang.*

The script languages auto-import those already themselves.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move the ImageJ 1.x macro templates to a more appropriate folder

The directory in which the templates are stored indicates the name
of the language. The name 'Macro' is awfully general, however. So
let's stick with 'IJ1 Macro'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This is the big switch to the new startup procedure

The intent of this switch is to make Fiji start up ImageJ2 in the future
instead of starting ImageJ 1.x and then letting the LegacyInitializer
spin up a corresponding ImageJ2 context.

This implies that we will have to reuse the same class loader for
ImageJ2, ImageJ 1.x and ImageJ 1.x' plugins. As a consequence, we will
have to discontinue support for Help>Refresh Menus, but given that
there are now much better ways to develop plugins in Integrated
Development Environments (such as Eclipse, Netbeans, etc), that is
not too big of a concession.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge 'ij1-macro-engine' into HEAD
Merge 'ij1-auto-imports' into HEAD
Merge 'script-templates' into HEAD
Merge 'legacy-startup' into HEAD
TO-UNDO
Merge remote-tracking branch 'origin/initializer' into script-editor-templates

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

Conflicts:
	src/main/java/net/imagej/legacy/IJ1Helper.java
wip