Ticket #985 (closed defect: fixed)

Opened 6 years ago

Last modified 3 years ago

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 6 years ago 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 6 years ago 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 6 years ago by curtis

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

comment:4 Changed 5 years ago by curtis

  • Blocking 749 added

comment:5 Changed 5 years ago by curtis

  • Blocking 1162 added

comment:6 Changed 5 years ago by curtis

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

comment:7 Changed 5 years ago by curtis

  • Blocking 1356 added

comment:8 Changed 5 years ago by curtis

  • Blocking 1291 removed

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

comment:9 Changed 5 years ago by curtis

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

comment:10 Changed 5 years ago by bdezonia

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

comment:11 Changed 3 years ago 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

Note: See TracTickets for help on using tickets.