Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [re-opened] Order of mixed 'action' and 'command' menu items in RCP
[re-opened] Order of mixed 'action' and 'command' menu items in RCP [message #777348] Tue, 10 January 2012 10:11 Go to next message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

At the moment I have two menus in my RCP application: File and Help.

The File menu is created via a command:
<extension point="org.eclipse.ui.menus">
  <menuContribution allPopups="false" 
                    locationURI="menu:org.eclipse.ui.main.menu">
     <menu
           id="fileMenu"
           label="File"
           mnemonic="F"
           tooltip="Main Menu">
        <command
              commandId="myPlugin.bundle.menuCommands.Exit"
              label="Exit"
              mnemonic="E"
              style="push"
              tooltip="Exits MyPlugin">
        </command>
     </menu>
  </menuContribution>
  </extension>

<extension point="org.eclipse.ui.commands">
  <command defaultHandler="myPlugin.bundle.commands.exit.ExitHandler"
        id="myPlugin.bundle.menuCommands.Exit"
        name="Exit">
  </command>
</extension>


The Help menu (with only the About menu item) is created via the respective action in ApplicationActionBarAdvisor:

protected void makeActions(IWorkbenchWindow window) {
    aboutAction = ActionFactory.ABOUT.create(window);
    register(aboutAction);
}

protected void fillMenuBar(IMenuManager menuBar) {
    MenuManager helpMenu = new MenuManager("&Help", "helpMenu");
    helpMenu.add(aboutAction);
    menuBar.add(helpMenu);
}


Now, the Help menu comes before the File menu in the menu bar. This is obviously not how it's supposed to be. How can I change the order of the menus?

Many thanks!

[Updated on: Tue, 10 January 2012 11:45]

Report message to a moderator

Re: [solved] Order of mixed 'action' and 'command' menu items in RCP [message #777351 is a reply to message #777348] Tue, 10 January 2012 10:16 Go to previous messageGo to next message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

Ah, solved this by simply adding a MenuManager in the ApplicationActionBarAdvisor for the File menu:

MenuManager fileMenu = new MenuManager("&File", "fileMenu");
    	helpMenu.add(aboutAction);
    	menuBar.add(fileMenu);
    	menuBar.add(helpMenu);


D'uh! Smile
Re: [solved] Order of mixed 'action' and 'command' menu items in RCP [message #777387 is a reply to message #777351] Tue, 10 January 2012 11:46 Go to previous message
Stephan Druskat is currently offline Stephan DruskatFriend
Messages: 104
Registered: October 2011
Location: Berlin, Germany
Senior Member

Hm, having second thoughts now. Is this really how it should be done? This would mean for every menu I create in the Extension Wizard, I have to put a new line of code in the ApplicationActionBarAdvisor...
Previous Topic:Help to draw different images in table according element data?
Next Topic:How do I get a menu item to refresh?
Goto Forum:
  


Current Time: Fri Apr 19 22:57:39 GMT 2024

Powered by FUDForum. Page generated in 0.03785 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top