How to order actions in the Eclipse RCP menu

If I add an action to the extension point this way:

    <action
           class="com.mycompany.MyAction"
           id="mycompany.myaction.MyAction"
           menubarPath="actions"
    />

How can I manage its ordering programmatically? It looks like they are just sorted alphabetically according to their identifier. I do not want to give them names like "001-z", "002-a", just so that "z" appears before "a". It would also be a nightmare ordering them later.

+3
source share
2 answers

You should not use actions for the menu. Try commands instead. See here: http://www.vogella.de/articles/RichClientPlatform/article.html#commands_menu

If you want to order them, use:? After = ....

 <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:org.eclipse.ui.main.menu?after=fileMenu">
         <menu
               id="myMenu"
....
+1
source

. (. https://bugs.eclipse.org/91122 PluginActionBuilder.contributeMenuAction(), )

+1

Source: https://habr.com/ru/post/1732567/


All Articles