| Summary: | RCP App template should use IWorkbenchActionConstants | ||
|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | Pascal Rapicault <pascal> |
| Component: | UI | Assignee: | Cherie Wong <cherie.wong> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | wassim.melhem |
| Version: | 3.1 | ||
| Target Milestone: | 3.1 M5 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Pascal Rapicault
can you provide a concrete example? In the RCP Tutorial 3, you can find the following:
private MenuManager createFileMenu(IWorkbenchWindow window) {
MenuManager menu = new MenuManager(Messages.getString("File"), //$NON-NLS-1$
IWorkbenchActionConstants.M_FILE);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(ActionFactory.QUIT.create(window));
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
return menu;
}
Cherie, we may not be using IWorkbenchActionConstants for 'File'. please fix it if necessary. RCP Mail Template code for menu generation was changed from:
MenuManager fileMenu = new MenuManager("&File", "file");
MenuManager aboutMenu = new MenuManager("&About", "about");
to:
MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
MenuManager aboutMenu = new MenuManager("&About", "about");
Additionally, the "about" can use...
1. IWorkbenchActionConstants.ABOUT (deprecated)
2. IDEActionFactory.ABOUT.getId() (the recommended replacement for deprecated #1)
However, since #1 is deprecated and IDEActionFactory does not have an ABOUT
ActionFactory, I have not made any changes to the About menu here. I can
definitely make that change if desired -- just let me know :)
Changes are currently in head. Marking as fixed :)
In my previous comment, I mentioned the possibility of making the change to the About menu id, "about". Just to clarify, I only mean for #1 (deprecated IWorkbenchActionConstants.ABOUT) to be an option in this case as I doubt you all would want to add a dependency on o.e.ui.ide for an RCP app. :) ARGh ! I copied the wrong snippet. The comment for IWorkbenchActionConstants.ABOUT is incomplete. It should have the following line: org.eclipse.ui.ActionFactory.ABOUT.create(IWorkbenchWindow) which does not require new dependencies. Hi Pascal!
Just to recap our conversation just now, the "about" text could be changed to
use ActionFactory.ABOUT.getId(); however, this would likely cause confusion as
the action id and menu id are two different things. Thus, the code will stay
as is :)
The code snippet currently appears in ActionBuilder as:
public void populateMenuBar(IActionBarConfigurer configurer) {
IMenuManager mgr = configurer.getMenuManager();
MenuManager fileMenu = new MenuManager("&File",
IWorkbenchActionConstants.M_FILE);
MenuManager aboutMenu = new MenuManager("&About", "about");
// Allow contributions to the top-level menu
mgr.add(fileMenu);
mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
mgr.add(aboutMenu);
// File
fileMenu.add(newWindow);
fileMenu.add(new Separator());
fileMenu.add(messagePopup);
fileMenu.add(openViewAction);
fileMenu.add(new Separator());
fileMenu.add(exitAction);
// About
aboutMenu.add(aboutAction);
}
Thanks!
|