[英]How to make my plugin contributes adding a menu-item into an existing sub-menu from an existing menu in Eclipse platform?
Currently I'm working in an Eclipse plug-in project where I have created a View which could be displayed by clicking on main menu Window->Show view->Other... , then clicking on my View from the Other category. 当前,我正在一个Eclipse插件项目中创建一个View,可以通过单击主菜单Window-> Show view-> Other ... ,然后在Other类别中单击我的View来显示该View。
Currently I'm trying this in my plugin.xml
file: 目前,我正在我的
plugin.xml
文件中尝试此操作:
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:window?after=additions">
<menu
id="com.kwantec.helloworld.menus.sampleMenu"
label="Sample Menu"
mnemonic="M">
<command
commandId="com.kwantec.helloworld.commands.sampleCommand"
id="com.kwantec.helloworld.menus.sampleCommand"
mnemonic="S">
</command>
</menu>
</menuContribution>
</extension>
..that causes a new sub-menu Sample Menu
appears into the existing Window
menu of Eclipse. 导致新的子菜单“
Sample Menu
出现在Eclipse的现有“ Window
菜单中。 Then I can open my View by clicking on Window->Sample Menu->Sample Command
. 然后,我可以通过单击
Window->Sample Menu->Sample Command
打开我的视图 。 But now, what I need it's to directly add that Sample Command
into menu-items of sub-menu Show View
from existing Window
menu of Eclipse. 但是现在,我需要的是直接从Eclipse的现有
Window
菜单中将该Sample Command
直接添加到Show View
子菜单的菜单 项中。 Something like Window->Show View->Sample Command
. 类似于
Window->Show View->Sample Command
。
I have spent several days looking into Eclipse Platform documentation without significant advance. 我花了几天时间研究Eclipse Platform文档,但并没有取得重大进展。 Does anybody knows how to do this?
有人知道该怎么做吗?
Thanks in advance. 提前致谢。
Views shown directly in 'Window > Show Views' are known as 'view shortcuts'. 直接在“窗口>显示视图”中显示的视图称为“视图快捷方式”。 You add these for a particular perspective using the
org.eclipse.ui.perspectiveExtensions
extension point. 您可以使用
org.eclipse.ui.perspectiveExtensions
扩展点将它们添加到特定的角度。
Something like: 就像是:
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.ui.resourcePerspective">
<viewShortcut id="your.view.id"/>
</perspectiveExtension>
</extension>
Herer targetID
defines the perspective you are updating and the id
of viewShortcut
is the id of your view. Herer
targetID
定义要更新的角度和id
的viewShortcut
是您的视图的ID。
You may need to reset the perspective to get your addition to show (Window > Perspective > Reset Perspective). 您可能需要重置透视图才能显示添加的内容(“窗口”>“透视图”>“重置透视图”)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.