Platform UI Command Design
Starting point for menu and toolbar placement of commands in 3.3. Please contribute comments and suggestions in the discussion area.
- Provide a single concept for contributing to the workbench. Right now, there are two distinct ontologies: actions and contribution items; and commands and handlers.
- Support the addition and removal of plug-ins.
- Separate model and behaviour from visual presentation. Adhere more closely to the Model-View-Controller pattern. Model and user interface separation.
- Extensibility. Every group of items in the user interface (e.g., menu, tool bar, etc.) should be extensible – both in structure and content.
- Universal keyboard shortcuts. A user should be able to add a keyboard shortcut to any item that appears in the user interface (e.g., menu item, tool item, menu, etc.).
- Separation of structure and content. The structure of the menus (e.g., groups) should be defined independently from the items.
- No implicit declarations of structure or content. Everything should be explicit.
- Fine-grained control over visibility.
- More intelligent updating of elements within the user interface. Support for lazy updating for elements that are not showing within the user interface. This lazy updating should be handled automatically – without the elements needing to understand whether they are showing.
- Improved control over menu definition and item ordering. This will affect the “Search” and “Run” menus.
- The selection should be capable of overriding the behaviour of a user action. For example, if a Java element is selected in the Resource Navigator, a rename should be a refactoring rename.
- Address the difficulty in determining the keyboard shortcuts to show for context menu items.
- Support dynamic entries in top-level menus. For example, the recently opened files in the “File” menu should be possible using only public API.
- There should be an easy way to define the default behaviour in response to a user action (i.e., default handler for a command).
- Provide localized control of the model, view and controller elements talked about in this proposal. This includes such concepts as automatic addition/removal as parts are become active/inactive, and automatic removal as parts are destroyed.
- Allow the same user interface element to be placed in multiple locations. Reduce duplication in the syntax, and try to reduce memory usage.
- Provide facilities for finding and triggering elements within the user interface. This is intended to provide better support for the welcome facilities, cheat sheets, macros and scripting.
- JFace must not lose functionality. Everything that can be accomplished with JFace must still be possible in JFace, even if the API changes radically. Similarly, everything that can be accomplished with the workbench must still be possible in the workbench.
- Contribute all of the workbench and IDE model, view and controller elements using the API from this proposal. Everything that the workbench and IDE can do should be possible for third-party plug-ins as well.
- Contributing arbitrary controls (e.g., combo boxes) to Eclipse, where appropriate.
Command Architecture Overview
Commands are managed by the org.eclipse.ui.commands extension point and the ICommandService.
Handlers are managed by the org.eclipse.ui.handlers extension point and the IHandlerService.
KeyBindings are managed by the org.eclipse.ui.bindings extension point and the IBindingService.
Contexts are managed by the org.eclipse.ui.contexts extension point and the IContextService.
There are a couple of reasons why keybindings and commands might not work.
- Keybindings are in a context that is not active
- There is a keybinding conflict
- No handler is currently active for the command
- There is a handler conflict
To help track down the problem, you can run with debug tracing options. For example:
org.eclipse.ui/debug=true org.eclipse.ui/trace/keyBindings=true org.eclipse.ui/trace/keyBindings.verbose=true org.eclipse.ui/trace/sources=true org.eclipse.ui/trace/handlers=true org.eclipse.ui/trace/handlers.verbose=true #org.eclipse.ui/trace/handlers.verbose.commandId=org.eclipse.ui.edit.copy org.eclipse.ui/trace/handlers.verbose.commandId=org.eclipse.jdt.ui.navigate.open.type org.eclipse.ui/trace/contexts=true org.eclipse.ui/trace/contexts.verbose=true
I put these options in a debug.options file and run eclipse using:
bash$ eclipse -debug debug.options -data /opt/local/pw_workspace >debug.log 2>&1
This logs the debug output to the debug.log file. This works on windows as well:
C:\development> eclipse32\eclipse.exe -debug debug.options -data workspaces\pw_workspace >debug.log 2>&1
handlers.verbose.commandId allows you to track the information about a specific command that isn't working. org.eclipse.jdt.ui.navigate.open.type is the open type dialog (normally CTRL+SHIFT+T) and org.eclipse.ui.edit.copy (commented out) is COPY (normally CTRL+C)
Currently, menus are managed by 4 extension points:
Programmatic contributions are managed through a number of locations: IActionBars, IViewSite, IEditorSite ... more to follow
The Contribution proposal started a couple of releases ago Contribution RFC
There are discussions in a number of places: