Start up legacy service in legacy mode

While the LegacyService is being initialized, we cannot rely on any
ImageJ2 services yet. So the best idea is to say that we're in legacy
mode. If an ImageJ 1.x instance is currently running, our best bet is
to stay in legacy mode. Otherwise, let's switch to modern mode just
after initialization is complete -- toggleLegacyMode() knows that it
should not try to show anything if no UI is available.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Switch To Modern Mode: toggle all ImagePluses WindowManager knows about

When starting Fiji in ImageJ 1.x mode, switching to modern mode after
opening images should take them to modern mode, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHacker: mark classes explicitly as frozen after loading them

This hopefully helps a little bit with the upcoming move of stuff from
Fiji's IJ1Hacker to ij-legacy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHacker: commit all handled classes at the end

That should help with the upcoming move of stuff from fiji-compat:
some classes are handled multiple times and in different ways, so we
should only define the classes at the very end.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move some backwards-compatible legacy stuff from fiji-compat to ij-legacy

This adds back some legacy methods that should have been marked as
@Deprecated instead of removed without warning.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move fiji-compat's special handling for Apple's Mighty Mouse

On some Linuxes, the horizontal scroll wheel of the Mighty Mouse is
mistaken for a popup trigger. This change adds a work-around.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: add back some legacy ij.ImagePlus methods

These methods went away at some stage without being marked as
@Deprecated first.

Moved from fiji-compat.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move some ij.IJ patches over from fiji-compat

This change makes sure that ImageJ 1.x is properly initialized when
calling macros in batch mode.

It also adds the ij.log.file handling: when this property is set,
IJ.log() will log not only to the Log window but also to the file
pointed to by the property.

While at it, runUserPlugIn() sets the context class loader for the
benefit of scripting languages and SezPoz (and therefore ImageJ2).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Fix ImageJ 1.x quitting in legacy mode

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add extent calx to DataRange
Make ThresholdMethods utilize Histogram1d's
Update Threshold to use Histogram1d's
Fix bug in determining threshold range
Eliminate call to Histogram::dfd()
ELiminate call to Histogram::dfd()
Move the headless legacy code from Fiji to ImageJ2

It is in general a very hard problem to let code run headlessly that
relies on GUI classes.

In Fiji (actually, before that, in ImageJA), we started to support that by
replacing GUI classes by non-GUI classes so that ImageJ could run without
a graphical desktop.

Later, we converted that code to use Javassist for easier maintenance.

Now, let's add unit tests to ensure a certain level of reliability of the
legacy headless mode; it will never be a 100% complete, but hopefully good
enough for many applications. For those where the legacy headless mode is
not good enough, there is simply no good excuse: they need to be ported to
leverage the ImageJ2 architecture.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Update ImgLib2 version to 2.0.0-beta-8
Merge branch 'use-histograms'
Add unit tests for the legacy headless support

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Improve LegacyHeadless' javadoc

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