|
|
|
Re: Common Navigator - Global menu contributions [message #336115 is a reply to message #336104] |
Thu, 21 May 2009 23:26 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Thomas Spall![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=tspall%40opencloud.com) Messages: 29 Registered: July 2009 |
Junior Member |
|
|
Hi,
I think I wrongly assumed the Common Navigator owns the "New>Project..."
and "New>Examples..." entries etc.. That's why I thought I must be able to
tell it somehow to put these entries not only in its popup menu but also
to contribute them to the workbench menu. Well, it looks like you CAN'T
tell it to do that.
So, you have to setup that file>New menu yourself. How to do that?...After
searching around quite blindly, I finally stumbled upon some classes in
the the 'org.eclipse.ui.actions' package.
The 'ActionFactory' and 'ContributionItemFactory' in there were kind of
known and I (possibly again wrongly) assumed that they were capable of
manufacturing all items necessary for setting up menus. But this here is
eclipse, so obviously that would be too easy a solution!...in the same
package there is another class, 'NewWizardMenu', which doesn't get
manufactured, and THAT is what I was looking for. In the defining plugin
of your RCP application there will be a class called 'XXXActionBarAdvisor'
with a 'fillMenuBar()' method. Here's the code snippet of what should be
in there to show the standard "File>New>Project..." "File>New>Examples..."
etc. entries:
protected void fillMenuBar(IMenuManager menu) {
IMenuManager fileMenu = new MenuManager(
Messages.ApplicationMenuName_File,
IWorkbenchActionConstants.M_FILE);
fileMenu.add(new
GroupMarker(IWorkbenchActionConstants.FILE_START));
IMenuManager fileNewMenu = new MenuManager(
Messages.ApplicationMenuName_New, "new");
NewWizardMenu newWizardMenu = new
NewWizardMenu(this.getWindow(), "some.id.of.your.wild.choice");
fileNewMenu.add(newWizardMenu);
GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
fileMenu.add(fileNewMenu);
...
(other menu setups like EDIT, HELP)
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04037 seconds