Reputation: 17
I have developed a IDE for a custom language in Eclipse 3 for RCP and RAP developers. Therefore I used IDE plug-ins wherever possible and applicable. This week I was busy migrating the application to Eclipse e4 (with compatibility layer) with Eclipse for RCP and RAP developers 2021-6. Everything works nearly fine so far.
The one thing i cannot figure out is how I can place the "run" menu where I want. It is placed as first menu in the menu bar.
Another strange thing by the way is that if I use Eclipse 2020-6 instead of 2021-6 as development environment, also the search menu is at the wrong position.
The problem is that the run and search menus come from an IDE plug-in and they are implemented as actions and therefore I cannot specify any order in terms of menus. For all other menus I defined appropriate menuContibution
s, commands and handlers. For the latter, I can decide where each menu should be placed with the help of plugin.xml by specifying ?before=
or ?after=
.
I did a search over stackoverflow issues that have to do with adding menus, reorderung menus, mixing actions with commands and handlers and so on but I could not find a solution how I could place the run menu where I want.
I hoped that there would be something like an ID that I can use to specify as ?before=
or ?after=
in plugin.xml but I think this will not work with actions.
Can anyone give me a hint how I could place all menus in the desired order? Or is this simply impossible when mixing actions and commands+handlers? Is there any actions-wrapping functionality in order for me to specify ?before=
or ?after=
in my menuContibution
s in plugin.xml?
Upvotes: 0
Views: 128
Reputation: 17
Thanks to greg-449, I finally figured it out. The following definition finally solved my problem (--> ?before=org.eclipse.ui.run
):
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu?before=org.eclipse.ui.run">
<menu
id="at.boi.tabex.dvl.mainmenu.file"
label="&File">
</menu>
<menu
id="at.boi.tabex.dvl.mainmenu.edit"
label="&Edit">
</menu>
<menu
id="at.boi.tabex.dvl.mainmenu.project"
label="&Project">
</menu>
<menu
id="at.boi.tabex.dvl.mainmenu.tools"
label="&Tools">
</menu>
<menu
id="at.boi.tabex.dvl.mainmenu.table"
label="&Ta&ble">
</menu>
</menuContribution>
</extension>
Upvotes: 0
Reputation: 111216
If you mean the Run menu added by the org.eclipse.debug.ui
plug-in this is created using and action set:
<extension point="org.eclipse.ui.actionSets">
<actionSet
label="%BreakpointActionSet.label"
visible="false"
id="org.eclipse.debug.ui.breakpointActionSet">
<menu
label="%RunMenu.label"
path="additions"
id="org.eclipse.ui.run">
which is adding the Run menu at the position additions
in the main menu.
The standard main menu created by org.eclipse.ui.internal.ide.WorkbenchActionBuilder
creates the main menu like this:
@Override
protected void fillMenuBar(IMenuManager menuBar) {
menuBar.add(createFileMenu());
menuBar.add(createEditMenu());
menuBar.add(createNavigateMenu());
menuBar.add(createProjectMenu());
// This line creates the 'additions' position
menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menuBar.add(createWindowMenu());
menuBar.add(createHelpMenu());
}
Upvotes: 0