kloklo90 kloklo90 - 1 year ago 105
Java Question

Moving custom menuManager at the end of existing RCP app menu

I am working with an RCP application menu. As seen in the image below I am trying to move my newly added Help menu at the end of the freebies menus that come with my RCP application. Currently the code just adds it to the menubar by using a class that was created derived from ActionBarAdvisor .

public class ApplicationActionBarAdvisor extends ActionBarAdvisor

Looking at the other methods available I see an appendToGroup method that might be interesting to use. Only thing is that it requires a groupName and I don't have one. The menu ids I have been using don't seem to suffice as a groupName.

Where I want the menu to go

Here is my code

@Override protected void fillMenuBar(IMenuManager menuBar)
{
MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
//menuBar.appendToGroup(menuBar.getId(), helpMenu);
menuBar.add(helpMenu);
helpMenu.add(aboutAction);
}


enter image description here

Fixed it

enter image description here

Answer Source

It's much easier to use the built-in Help menu of Eclipse. This whole action is resumed by adding the help menu right after the other menus in the plugin.xml file <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:org.eclipse.ui.main.menu"> <menu label="File"> <command commandId="org.eclipse.ui.file.exit" label="Exit"> </command> <command commandId="org.eclipse.ui.file.save" label="Save" style="push"> </command> </menu> <menu label="Help"> <command commandId="org.eclipse.ui.help.aboutAction" label="About"> </command> <command commandId="org.eclipse.ui.help.helpSearch" label="Search"> </command> </menu> </menuContribution>

Final Result picture in question area :) I can't load it here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download