Analysis
Overview
Create a menu library that allows plugins to add menus and menu items. The library should have an extension point that allows a plugin to register itself and be queried for menus and menu items. Currently menus are implemented in org.sophie2.main.view.menus and the main menubar is hard coded to specific menus. This should change because plugins need to be able to add their own menus or menu items.
The idea of this task is to decentralize menus. A library that lets someone use an extension point to register a menu item in a menu achieves this. Both the menus and the menu items need to be able to supply some hint as to where the new menu and menu item should be sorted into the existing menubar/menu.
Task requirements
- Create a module for menubars, menus and menu items. Ask milo about the name for this module.
- Determine what should go in org.sophie2.func.file (if anything) and what should go in org.sophie2.main.view.
- Add extension point so plugins can register menu items in menus
- Menubars should sort menus by the sort key
- Document the new library
Task result
The result shall be code
Implementation idea
- Menus should have a sort key that allows menus to be sorted within a menu bar
- Menu items should have a sort key that allows menu items to be sorted within a menu bar
- The sort key could be a simple string. This will allow us to define a protocol for sorting in an initial pass of the code, and make the menu organization more sophisticated later.
- menu items need shortcuts, but those are platform specific (control-C to copy on windows, command-c to copy on the Mac) (maybe swing handles this?)
Related
How to demo
- Show the documentation for the menu library
- Show how to create a menu, menu item and register them through the extension point.
- Demo along with APP_BASIC_MENUS_R0 to show how this works.
Design
Implementation
(Implementation results should be described and linked here (from the wiki or the repository))
Testing
Comments
(Write comments for this or later revisions here.)