tekumara
tekumara

Reputation: 8807

How to make my menu contribution appear after a plug-in menu contribution?

I have defined an Exit command to display on my File menu. However another plug-in is contributing a Open File item on the File menu and this is appearing AFTER my Exit command. I want my Exit command to appear last on the File menu.

I've tried specifying locationURI menu:file?after=org.eclipse.ui.openLocalFile but then my Exit menu item does not display at all. I think this might be because org.eclipse.ui.openLocalFile has not been loaded yet.

I've also tried specifying locationURI menu:file?after=additions but the Open File menu item still displays after mine.

How can I get the menu item order to be Open File and then my Exit command?

Upvotes: 1

Views: 1576

Answers (2)

smukov
smukov

Reputation: 625

I know that this question has been answered but I had similar problem and I solved it by specifing the ID for each command that I add to menu. Then I would use that ID in "after" or "before" query. I noticed that you tried something similar but you used the "commandId" instead of the actuall "id".

Upvotes: 1

Paul Webster
Paul Webster

Reputation: 10654

You need to put some of the proper group markers in your File menu when you create it. The order of operations is:

  1. ActionBarAdvisor creates MenuManagers programatically
  2. org.eclipse.ui.menus are applied
  3. legacy action extensions are applied (like actionSets)

Open File says it has a menubarPath="file/new.ext". So however you create your File menu, you must add a group marker for new.ext. The group markers will allow you to control the contribution order.

See org.eclipse.ui.internal.ide.WorkbenchActionBuilder in org.eclipse.ui.ide for an example of the group markers the eclipse IDE includes.

Upvotes: 2

Related Questions