本文主要是介绍rcp(插件开发)org.eclipse.ui.menus-可以添加在视图上,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
以下是eclipse help中的内容
org.eclipse.ui.menus
Commands can be implemented using org.eclipse.ui.handlersand bound to keys usingorg.eclipse.ui.bindings. With the org.eclipse.ui.menusextension point they can be placed in the main menu, view dropdown menus, context menus. They can also be added to the main toolbar, view toolbars, and various trim locations.
Contribution location
The older action contribution points use the concept of menu and toolbar pathsto place menu items and tool items. The org.eclipse.ui.menusextension point requires the id of a menu, toolbar, or trim area and an insertion point. This is the locationURI of a <menuContribution/> element. Some examples of locationURIs:
- menu:org.eclipse.ui.main.menu?after=window - insert this contribution in the main menu after the Window menu.
- menu:file?after=additions - insert this contribution in the File menu after the additions group. Equivalent to the old menubarPath="file/additions".
- menu:org.eclipse.ui.views.ContentOutline?after=additions - insert this contribution in the Content Outline view dropdown menu after the additions group.
- toolbar:org.eclipse.ui.views.ContentOutline?after=additions - insert this contribution in the Content Outline view toolbar, after the additions group.
- popup:org.eclipse.ui.examples.propertysheet.outline?after=additions - insert this contribution in the Property Sheet outline page context menu after the additions group.
A word about popup: locationURIs. In popup:id
, the id refers to the id that comes from registering the context menu when the registerContextMenu(*) method is called. If an no id is specified in the call, it defaults to the id of the view or editor registering the context menu.
The workbench defines all of its group slot names in the classes IWorkbenchActionConstantsand IIDEActionConstants. These ids, like the file example above, are available to menu contributions.
After the locationURI specifies the insertion point, the <menuContribution/> elements are turned into IContributionItems and inserted in order. Another difference between menu contributions and action contributions is that the menu contributions can be defined in the XML in the same kind of containing relationship that one would would see in a menu or toolbar.
Let's start with a simple example from our Info example, adding some commands to the InfoView.
<extension point="org.eclipse.ui.menus"> <menuContribution locationURI="menu:org.eclipse.ui.examples.contributions.view?after=additions"> <command commandId="org.eclipse.ui.examples.contributions.view.count" mnemonic="%contributions.view.count.mnemonic"> </command> <command commandId="org.eclipse.ui.examples.contributions.view.edit" mnemonic="%contributions.view.edit.mnemonic"> </command> <command
这篇关于rcp(插件开发)org.eclipse.ui.menus-可以添加在视图上的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!