Ticket #1354 (closed enhancement: fixed)
Opened 2012-07-30T10:42:21-05:00
Last modified 2012-12-27T10:56:10-06:00
Implement Help>Start Legacy ImageJ
Reported by: | dscho | Owned by: | dscho |
---|---|---|---|
Priority: | major | Milestone: |
|
Component: | Legacy Compatibility | Version: | |
Severity: | serious | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #1010, #1011, #1016, #1458, #1584 |
Description
Even if our legacy service is already quite good and will get even better, there are probably a few legacy plugins we cannot possibly support without re-implementing them.
As a work-around for people whose workflow relies on such plugins, let's implement Help>Start Legacy ImageJ, which will hide all ImageJ 2.x windows, open all legacy ij.ImagePlus instances and show the ImageJ 1.x window.
To this end, we need to inject a boolean legacyMode field into ij.IJ which our hacked ImageJ 1.x will handle to skip the ImageJ 2.x-specific special casing.
It was briefly discussed whether it would make more sense to have a separate class loader run an unpatched ImageJ 1.x and convert all the images. But Curtis & Johannes deemed this approach too fragile: no method could access instances of both class loaders at the same time without major (weakly typed) hackery.
Change History
comment:3 Changed 2012-07-31T02:34:13-05:00 by curtis
- Owner changed from gharris to dscho
- Status changed from new to assigned
- Milestone changed from imagej-2.0.0-beta5 to imagej-2.0.0-beta4
comment:4 Changed 2012-08-03T13:32:22-05:00 by dscho
In a discussion with Barry I just realized that the changes to the javassist'ed code are a little more involved: we need to maintain the mapping between ImagePlus instances and their corresponding Dataset instances even if in legacy mode, so that the images are available when clicking the (to be added after Help>Start Legacy ImageJ) Help>Switch Back To ImageJ2.
comment:5 Changed 2012-08-17T16:47:02-05:00 by dscho
A start has been made in the 'legacy' branch. It is very much work in progress; so far, it only shows the ImageJ1 main window and the ImageJ1 ImageWindows. In the least, we need to
- hide the ImageJ2 main window
- hide the ImageJ2 image windows
- add a Help>Stop Legacy Mode
The last point is very easy: we will just look whether ImageJ1's command table already contains that entry and if not, add it to the menu and put an entry into the command table that refers to a to-be-written class.
We will exploit one obscure quirk of ImageJ1: if the command table refers to a class that implements neither ij.plugin.PlugIn nor ij.plugin.filter.PlugInFilter, it is not an error, but the class is just constructed. That allows the class to do something very dirty: call all the logic from the constructor. (This developer will feel slightly dirty about making this hack, but will make sure everything is properly documented in the Javadoc. Or maybe just bite the bullet and implement an ij.plugin.PlugIn since we depend on ij.jar anyway.)
We must take pains not to execute these hacks unless the user called legacy mode, however: if we would always do it on start-up of the legacy service, headless operation would break rather badly.
comment:6 Changed 2012-08-20T14:15:48-05:00 by dscho
Further progress on the 'legacy' branch: all the remaining points have been addressed. But of course there are new problems:
- To be able to stop the legacy mode from the command finder, there is now a dependency on SwingUtilities#invokeLater(Runnable) in the LegacyService. Of course, this is only a work-around for an issue in the display service where it is currently assumed that we're running on the Event Dispatch Thread (this will have to be fixed properly, of course).
- The legacy service's update/create functionality was never prepared for the possibility that there might be a need not to show the updated/created image windows. So the whole code around holding off from displaying changes until legacy mode was terminated is currently very fragile.
comment:7 Changed 2012-09-06T19:01:11-05:00 by dscho
- Milestone changed from imagej-2.0.0-beta4 to imagej-2.0.0-beta5
comment:9 Changed 2012-12-19T16:29:34-06:00 by bdezonia
- Milestone changed from imagej2-b7-ndim-data to imagej2-b6-legacy-undo
comment:11 Changed 2012-12-19T16:31:08-06:00 by bdezonia
Legacy branch merged on 12-19-12.
comment:12 Changed 2012-12-27T10:56:10-06:00 by curtis
- Status changed from assigned to closed
- Resolution set to fixed