ij-legacy: move MacAdapter handling from LegacyInjector to
LegacyExtensions

The MacAdapter patches are really needed for the legacy mode, and we
decided some time ago that that category of legacy patches should be
separated from the patches synchronizing legacy and modern state.

Technically, LegacyInjector *would* be the correct location if we still
just switched off the MacAdapter. However, we cannot switch it off at
all times anymore because that would break legacy mode (and hence Fiji,
e.g. when the user wants to quit the application)...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: clarify why we patch MacAdapter only sometimes

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add an application event for opening files

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
MacOSX: handle event when files are dropped onto the application icon

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: do not let MacAdapter do its thing

If we let MacAdapter run normally, we will not be able to install any
other application listener. But ImageJ2 needs to.

For the moment, this breaks Fiji's legacy mode again: neither Quit nor
Drag 'n Drop of files onto the Dock icon will work. We will fix that in
the next commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a MacOSX-specific event consumer for the legacy mode

Unfortunately, ImageJ 1.x' MacAdapter uses a deprecated method to
subscribe to the MacOSX-specific events that is incompatible with
ImageJ2's (non-deprecated) method.

Therefore, we need to override the MacAdapter. Let's do that in the
ImageJ2 way, by subscribing to the application events offered by
SciJava's event service.

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

This is required for legacy mode event delegator to work properly.
Otherwise, the ProxySubscribers of the delegator (created while
subscribing) would be GCed before they can do its.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Refactor LegacyInjector#setLegacyService context discovery

This will allow us to use the context to subscribe to specific events in
legacy mode.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Subscribe to SciJava's MacOSX-specific events in legacy mode

...and override the ImageJ 1.x' MacAdapter (which uses a deprecated
method to register a MacOSX-specific event handler that is incompatible
with ImageJ2's method).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
DefaultLegacyService: do not try to show the UI when initializing

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Clean up IJ1Helper's source code

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

This branch fixes the MacOSX-specific event handling (e.g. for opening
files via drag-drop on the to-be-started application icon) both for
startup in modern and in legacy mode.

Note that modern mode does not consume the AppOpenFilesEvent yet.

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

Conflicts:
        core/legacy/src/main/java/imagej/legacy/DefaultLegacyService.java
	core/legacy/src/main/java/imagej/legacy/IJ1Helper.java
	core/legacy/src/main/java/imagej/legacy/LegacyExtensions.java