Override the editor in Plugins>Macros>Edit...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Also override the editor in the toolbar

E.g. when shift-clicking the >> button and selecting Startup Macros.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Override the editor when clicking 'Show macro' in the command finder

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

This topic branch tries to plug all the locations where the editor is
called by ImageJ 1.x (it is really astonishing how many different
locations contain essentially the same code simply opening an editor
with a macro...).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyClassLoader: Make use of 'known' and 'shared' classes less confusing

The comment should make the purpose of the known and shared classes much
clearer. Also, by using static final hash maps, we can now easily extend
the list of shared and known classes (without that fragile 'sharedCount'
hack).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Format the LegacyClassLoader source code a bit

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move the NoSuchMethodException handler into LegacyHooks

Needed because EssentialLegacyHooks is not intended to be subclassed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Make sure that bare .class plugins in plugins/**/* are picked up by IJ1

When there is a A_.class file in, say, ImageJ.app/plugins/blub/x/, but the
corresponding class is actually not in the package blub.x, ImageJ 1.x
falls back to trying first x.A_ and then A_. For that to work, the
subdirectories have to be added to the class path.

Needless to say, requiring callers to make sure that the subdirectories
are contained in the class path would be such an inelegant solution that
we rather add rather ugly code to make sure that there is actually a
plugin class loader that contains said directories. But only if really,
really necessary.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge early part of remote branch 'callbacks' into HEAD

Let's cherry-pick the LegacyClassLoader clean-ups, even if we might
not end up merging the infrastructure for calls into the
encapsulated ImageJ 1.x...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Make IJ.getClassLoader() consistent

We should not return the class loader that happens to be the current
thread context class loader at the time IJ.getClassLoader() was called,
but rather the context class loader at the time the encapsulated ImageJ
1.x instance was initialized.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Leave preinit() early when the patches were already applied

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
alreadyPatched(): also look at the parent class loaders

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Patch the class loader containing the ImageJ 1.x classes

... not a class loader whose *parent* contains them...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a unit test for the class loader issues

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge 'context-class-loader' into HEAD
When intercepting opening images, make sure that LUTs are *not* intercepted

Noticed by Joe Szulczewski in http://fiji.sc/bugzilla/show_bug.cgi?id=757.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyHooks: add intercept hook for dnd files

For future flexibility, it would be good to be able to intercept when IJ
is asking to open a file via drag-and-drop.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Use SCIFIO when opening files via drag-n-drop

Tries using SCIFIO when given a File to open.

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