Ticket #1161 (closed enhancement: fixed)

Opened 8 years ago

Last modified 8 years ago

Use Application default JMenuBar on Mac

Reported by: curtis Owned by: bdezonia
Priority: major Milestone: imagej2-b3-headless
Component: UI Framework Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1162, #1182


The com.apple.eawt.Application class has a nice  setDefaultMenuBar(JMenuBar) command, which is used when no window is active, as well as when a window lacking a menu bar is active.

Unfortunately, this menu bar does not have any support for shortcut keys—they simply do not work. But now that we have the AcceleratorHandler tool, this may not be an issue for ImageJ.

See attached DefaultMacMenuBar.java for an illustration.


DefaultMacMenuBar.java Download (1.4 KB) - added by curtis 8 years ago.

Change History

Changed 8 years ago by curtis

comment:1 Changed 8 years ago by curtis

  • Blocking 1162 added

comment:2 Changed 8 years ago by curtis

  • Component changed from other to ij-ui

comment:3 Changed 8 years ago by curtis

The main thing to test is whether shortcut keys still work; e.g., for Command Finder, does L bring it up? Does Cmd+L bring it up? Etc.

If not, then check AcceleratorHandler to see if it's getting the keystroke at all, and improve it to launch the right plugin in both cases.

If it works, we may not need to clone menu bars anymore at all... can try commenting out platformService.setMenuBarDuplicated(true) in the MacOSXPlatform configuration.

comment:4 Changed 8 years ago by bdezonia

There is a initial implementation in the fix-menus branch. Waiting for Curtis to look at. It only ever creates menus once. The current implementation works but needs enhancement. We need to allow menus to be surgically altered before we could consider this ticket closed. Once that code is in place then handling Image Type checkboxes and active Window checkbox should be fairly simple. The plan would to have a default menu and then separate context menus for things like the script editor.

comment:5 Changed 8 years ago by bdezonia

  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta2

comment:6 Changed 8 years ago by bdezonia

  • Milestone changed from imagej-2.0.0-beta2 to imagej-2.0.0-beta3

comment:7 Changed 8 years ago by bdezonia

  • Blocking 1182 added

comment:8 Changed 8 years ago by bdezonia

Currently code to do this is committed to master. There are some niggling issues that need to be ironed out and should be soon.

comment:9 Changed 8 years ago by bdezonia

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

The niggling outstanding bugs have recently been fixed.

Note: See TracTickets for help on using tickets.