NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #985 (closed defect: fixed)

Opened 2012-02-20T09:55:10-06:00

Last modified 2014-08-24T17:15:08-05:00

Multiple menu bars are not synced properly

Reported by: curtis Owned by: curtis
Priority: major Milestone: imagej2-unscheduled
Component: UI Framework Version:
Severity: major Keywords:
Cc: Blocked By: #988
Blocking: #749, #1630

Description

Multiple menu bars are not kept synced. That is, the main ImageJ application menu bar updates, but other copies added to individual image windows are not. This matters most on Mac OS X, where multiple copies of the menu bar must be maintained.

Change History

comment:1 Changed 2012-02-23T19:00:06-06:00 by dscho

I have rudimentary code for that in the script-editor branch now -- finally. Thanks to your changes in the ShadowMenu to add the parent, it was a breeze to add the root attribute, too.

What I changed now is a bit incomplete, but development is incremental, right? So far, the UIService no longer listens for events, and instead the SwingJMenuBarCreator learnt about that.

See  https://github.com/imagej/imagej/commit/8c34c6d9c2400 which relies on  https://github.com/imagej/imagej/commit/f21d18e10c3.

If I understand correctly, the only thing needed to push this down to AbstractMenuCreator is to teach that class a new abstract method to clear the menu (removeAll()). Unfortunately, it seems that the Swing framework has no way to replace individual menu items, so our idea to do more fine-grained updates might be a pipe dream after all.

There is an ugguly, ugguhlee hack in the script-editor branch, too, that replaces complete menus in the menu bar if the name matches ( https://github.com/imagej/imagej/commit/64e4c9c44c56873). However, this does not fully serve the goal I had in mind when writing it: I wanted existing menu bars which might have been initialised by code outside the IJ2 menu handling (think: 3D Viewer) to be handled gracefully. But this is a notoriously hard problem: how to discern between menu items that have been added outside versus menu items that have been removed? But then, if the event says exactly what needs to be done, we may not need to make that distinction in the code.

comment:2 Changed 2012-02-24T15:34:55-06:00 by curtis

  • Blocked By 988 added

Solving #988 will probably be sufficient to fully address this ticket as well, though testing will be needed.

comment:3 Changed 2012-02-27T11:01:00-06:00 by curtis

  • Milestone changed from imagej-2.0-beta1 to imagej-2.0-beta2

comment:4 Changed 2012-03-27T10:54:57-05:00 by curtis

  • Blocking 749 added

comment:5 Changed 2012-05-09T13:08:10-05:00 by curtis

  • Blocking 1162 added

comment:6 Changed 2012-07-12T11:11:38-05:00 by curtis

  • Blocking 1291 added; 1162 removed
  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta4

comment:7 Changed 2012-08-03T10:21:06-05:00 by curtis

  • Blocking 1356 added

comment:8 Changed 2012-08-03T10:22:25-05:00 by curtis

  • Blocking 1291 removed

(In #1291) Pushing some menuing tickets to 2.0.0-beta5; see #1356.

comment:9 Changed 2012-08-03T10:23:16-05:00 by curtis

  • Milestone changed from imagej-2.0.0-beta4 to imagej-2.0.0-beta5

comment:10 Changed 2013-01-22T15:41:35-06:00 by bdezonia

  • Blocking 1630 added; 1356 removed
  • Milestone changed from imagej2-b7-ndim-data to imagej2-unscheduled

comment:11 Changed 2014-08-24T17:15:08-05:00 by curtis

  • Status changed from new to closed
  • Resolution set to fixed

Long ago, we switched to the ImageJ 1.x trick of ripping off the menu bar and pasting it onto the newly activated window, rather than trying to keep multiple copies of the menu bar in sync. So this ticket is long resolved.

See also:
 http://stackoverflow.com/q/16175884