开发者

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.eclip开发者_JS百科se.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?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜