Merge pull request #12 from imagej/initializer

Move some code from the LegacyInitializer to the IJ1Helper
Be extra careful to avoid eternally bouncing status messages

Without this patch, a status message originating from modern mode
would bounce back and forth merrily, hogging the CPU rather nicely.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Avoid depending on EssentialLegacyHooks

The DefaultLegacyHooks need to be loaded in order to execute
DefaultLegacyService's initialize() method, but that is exactly where we
want to call the ij1-patcher that wants to patch the
EssentialLegacyHooks.

So far, that was not a problem because we always had a different class
loader to patch, but we are about to switch to a startup process where
we force ImageJ 1.x to use the same class loader for its plugins as for
its core classes. That means we have to be careful *not* to use the
EssentialLegacyHooks class prematurely.

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 method to IJ1Helper to evaluate macros

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Do not require the UI service to initialize the legacy service

Catch 22...

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>
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>
Make sure that the DefaultLegacyService has a slightly higher priority

We need to make certain that the LegacyUI is initialized only when the
legacy service is available already. That means that we have to make
certain that the DefaultUIService has a lower priority than the legacy
service. Or vice versa.

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>
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>
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>
Merge 'ij1-macro-engine' into HEAD
Merge 'ij1-auto-imports' into HEAD
Merge 'script-templates' into HEAD
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 'legacy-startup' into HEAD