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>