ij-legacy: port the icon stuff over from fiji-legacy

Now we can set the legacy mode windows' icon ourselves...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: port over fiji-compat's -batch-no-exit patch

Fiji has special code that allows scripts to re-use ij.ImageJ.main() by
passing the -batch-no-exit option that prevents said main() method from
calling System.exit().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Teach the CodeHacker to override field write accesses

Needed for the prefsDir handling about to be ported over from
fiji-compat's IJHacker into ij-legacy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy (Windows): do not store the preferences in the current directory

It is almost never what the user wants.

Ported over from fiji-compat.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: let Toolbar cope with tool names being prefixes of others

Ported over from fiji-compat.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Port fiji-compat's JavaScriptEvaluator patch to ij-legacy

This allows ImageJ 1.x to run Javascripts with the correct class
loader.

This patch does not address the race conditions in the
JavaScriptEvaluator class.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Port Fiji's fix for IJ1's Bio-Formats detection to ij-legacy

ImageJ 1.x' way to detect whether the Bio-Formats library is present is
obviously fragile: it tests whether a plugin was installed into
a menu entry with the label "Bio-Formats Importer".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: Port fiji-compat's Drag 'n Drop patch regarding symbolic links

This patch is needed to resolve parent directories for TrakEM2
projects correctly.

See Albert Cardona's explanation in

	https://github.com/fiji/ImageJA/commit/53d1b5dd9

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: Port fiji-compat's patch to ij.macro.Functions#call()

Sometimes, changes are not accepted into ImageJ 1.x' classes even if
contributed by the person who contributed the code in question.

This is the case, for example, for the call() handling in the macro
interpreter: its handler for InvocationTargetExceptions still uses
non-DRY code rather than handing off to IJ.handleException().

Usually, repeated code is just ugly and hard to maintain. In this case,
it is also a bug: if IJ.setExceptionHandler() is used to install
a different exception handler than ImageJ 1.x' default one, the macro
interpreter will still insist on doing its own exception handling.

That does not show up in standard ImageJ 1.x workflows, of course,
because they rarely entail a call to IJ.setExceptionHandler().

As long as ImageJ 1.x carries that bug, we must carry this bug fix
in ij-legacy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: allow more fine-grained code patching

The newly-introduced method allows to restrict the code patching to
one specific call.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: add "Convert to 8-bit Grayscale" to File>Import>Image Sequence

Ported over from fiji-compat: some Fiji users needed that option back,
but core ImageJ 1.x did not add it back.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: make sure no dialog is opened in headless mode

Ported over from fiji-legacy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add the CodeHacker#existsClass(String fullClass) method

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: teach ImageJ 1.x about https in addition to http

This patch comes originally from fiji-compat; in the meantime,
another method in ListVirtualStack also has hard-coded http://
handling without appropriate https:// handling.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Introduce CodeHacker#dontReturnOnNull(String fullClass, String methodSig)

This method allows us to override ImageJ 1.x' check whether an Editor
instance could be created. We need this because we do not necessarily
want that Editor to be used, but maybe Fiji's, or -- soon -- ImageJ2's.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Allow CodeHacker#replaceCallInMethod to replace constructor calls, too

When passing '<init>' as methodName, replaceCallInMethod will() now
happily replace calls to constructors just as it was already handling
method calls.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Prepare IJ1Helper to open an editor for a patched ImageJ 1.x

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Port fiji-compat's Script Editor hooks to ij-legacy

Fiji had to patch ImageJ 1.x in order to be able to use the fancy
script editor instead of the bland AWT-based one in ImageJ 1.x. We
will offer these extension points in ImageJ2 from now on, for use by
Fiji, but also by other 3rd-party software.

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