如何在弹出菜单中添加项目? [英] How to add items in popup menu?
问题描述
在eclipse插件开发中,我想在弹出菜单中添加一个项目(例如:Mystyle)。
对于一个实例,
项目资源管理器 - >右键单击 - >新建 - > MyStyle
如何在eclipse插件开发中实现? >
Regards
Mathan
这样做应该做遵循 , org.eclipse.ui.menus
- 扩展点与 menuContribution
,其 locationURI
-attribute指向 弹出窗口: org.eclipse.ui.popup.any?after = addedions
。
警告,作为 Prashant Bhate 在评论中提到,该软件包 org.eclipse.ui.popupMenus
已被弃用。
看到问题 objectContribution
和命令更多。
In eclipse plugin development, I want to add one item (eg: Mystyle ) in popup menu.
For an instance,
Project Explorer --> Right Click --> New --> MyStyle
How can I achieve this in eclipse plugin development?
Regards Mathan
Something like this should do it (following this thread):
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI=
"popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?after=additions">
<command
commandId="myplugin.command.mycommand"
icon="icons/etool16/mycommand.png"
label="Run mycommand"
mnemonic="M1+P"
tooltip="Do something with this project">
</command>
</menuContribution>
</extension>
See Menucontribution
Defines an ordered set of additions to the command UI structure. The defined elements will be added into the command UI structure at the location specified by the
locationURI
element.This should be the starting point for all contributions into menus, toolbars or trim, wherever they occur in the UI.
locationURI
- A URI specification that defines the insertion point at which the contained additions will be added.
The format for the URI is comprised of three basic parts:
- Scheme: One of "menu", "popup" or "toolbar.
Indicates the type of the manager used to handle the contributions- Id: This is either the id of an existing menu, a view id or the id of the editor 'type'
- Query: The query format is
<placement>=<id>
where:<placement>
is either "before" or "after" and<id>
is the id of an existing menu item
See also , org.eclipse.ui.popupMenus
org.eclipse.ui.menus
-extension point with a menuContribution
that has its locationURI
-attribute pointing to popup:org.eclipse.ui.popup.any?after=additions
.
Warning, as Prashant Bhate mentions in the comment, that package org.eclipse.ui.popupMenus
is deprecated.
See question Missing link between objectContribution
and command for more.
这篇关于如何在弹出菜单中添加项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!