问题描述
我已经定义了退出命令以显示在文件菜单上。但是,另一个插件在文件菜单上贡献了打开文件项,这在我的退出命令之后出现。我希望我的退出命令出现在文件菜单的最后。
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.
我尝试指定locationURI menu:file?after = org.eclipse。 ui.openLocalFile
,但是我的退出菜单项根本不显示。我认为这可能是因为尚未加载org.eclipse.ui.openLocalFile。
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.
我也尝试过指定locationURI menu:file ?after = additions
,但是在我之后仍然显示打开文件菜单项。
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:
-
ActionBarAdvisor
创建
MenuManagers
以编程方式 -
org.eclipse.ui.menus
- 旧式动作扩展名已应用
(如actionSets)
ActionBarAdvisor
createsMenuManagers
programaticallyorg.eclipse.ui.menus
are applied- legacy action extensions are applied(like actionSets)
打开文件说它具有menubarPath = 文件/new.ext。因此,无论您如何创建文件菜单,都必须为new.ext添加一个组标记。组标记将允许您控制贡献顺序。
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.
请参见 org.eclipse.ui.internal.ide.WorkbenchActionBuilder $ c $ org.eclipse.ui.ide 中的c>,以获取Eclipse IDE包含的组标记的示例。
See org.eclipse.ui.internal.ide.WorkbenchActionBuilder
in org.eclipse.ui.ide for an example of the group markers the eclipse IDE includes.
这篇关于如何使我的菜单显示在插件菜单显示之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!