Move all code ported from fiji-compat into its own class

The newly-introduced LegacyExtensions class serves several purposes, all
related to better operation in the legacy mode:

- it offers extension points, such as offering to override ImageJ 1.x'
  macro editor, overriding the application title or icon.

- it contains the runtime patching code using the CodeHacker to
  implement the extension points

- it contains functions implementing the extension points' operation, to
  be called by the runtime-patched ImageJ 1.x

- it contains backwards-compatibility fixes for ImageJ 1.x (such as when
  public methods were removed without being deprecated for a while
  first)

- it contains functions used by some backwards-compatibility fixes to
  avoid massive amounts of code being passed as String parameters to the
  CodeHacker, to allow for more informative compile errors/warnings than
  Javassist offers.

In particular the code we used to house in the IJ1Helper class is now much
safer: it lives in LegacyExtensions now which does not use any ImageJ 1.x
class directly; therefore it is safe to call, say, setAppName() *before*
running the LegacyInjector.

The main purpose of this class is to contain the ij-legacy code that is
not so much concerned with synchronizing the state between modern and
legacy, but which supports running in legacy mode, in particular running
Fiji in legacy mode without code duplication between Fiji and ImageJ2.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyExtensions: add a hook to run after Help>Refresh Menus in Legacy Mode

This is needed by Fiji to allow installing all those scripts into
the menus.

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