Marcos Scriven
Marcos Scriven

Reputation: 41

How to order actions in menus in Eclipse RCP

If I add action within an extension point thus:

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

How can I control its ordering programatically? It looks like they are simply ordered alphabetically according to their ID. I don't want to have to give them names such as '001-z', '002-a', just to get 'z' to appear before 'a'. It would also be a nightmare re-ordering them later.

Upvotes: 4

Views: 2310

Answers (2)

Prakash G. R.
Prakash G. R.

Reputation: 4892

The ordering of the actions under the same menubarpath is not properly defined. (see https://bugs.eclipse.org/91122 for more details or PluginActionBuilder.contributeMenuAction() if you need to see the code)

Upvotes: 1

Raven
Raven

Reputation: 561

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"
....

Upvotes: 1

Related Questions