如何在右键单击new-> MyNewMenu eclipse上添加弹出菜单? [英] how can I add popup menu in right-click new->MyNewMenu on eclipse?
问题描述
我试图创建一个eclipse插件,但是如何在新的上下文中添加一个新的弹出菜单?
I'm try to create a eclipse plugin... but how can I add a my new popup menu in the new context?
点击项目,将我的菜单放在New-> MyNewMenu
for example I right-click on the project and put my menu inside of New->MyNewMenu
中,在菜单上添加一个新项目File-New我正在使用这个
to add a new item on menu File-New I'm using this
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:new?after=additions">
<menu
id="Test1.menus.sampleMenu"
如果我尝试弹出菜单:新的?after =添加在locationURI这不工作...
but if I try popup:menu:new?after=additions on locationURI this not work...
当我使用RCP eclipse的间谍插件知道弹出窗口是返回
when I use the Spy plugin of RCP eclipse to know the popup id is returned
menu:null?after=additions
如何解决这个问题?
推荐答案
要获取文件>新建菜单中的某些内容,您必须使用 org.eclipse.ui.newWizards
扩展点来定义新向导。自己这样做只会使新向导出现在其他...部分。
To get something in the File > New menu you must use the org.eclipse.ui.newWizards
extension point to define a New wizard. On its own this will just make the New wizard appear in the 'Other...' section.
要添加到主要部分中显示的新向导列表中新菜单必须使用 org.eclipse.ui.perspectiveExtensions
扩展点来为新的向导定义一个 newWizardShortcut
。
To add to the list of new wizards shown in the main part of the New menu you must use the org.eclipse.ui.perspectiveExtensions
extension point to define a newWizardShortcut
for your new wizard.
JDT JUnit插件的新向导和快捷方式的示例:
An example of a new wizard and shortcut from the JDT JUnit plugin:
<extension
point="org.eclipse.ui.newWizards">
<category
name="%WizardCategory.name"
parentCategory="org.eclipse.jdt.ui.java"
id="org.eclipse.jdt.junit">
</category>
<wizard
name="%TestCaseWizard.name"
icon="$nl$/icons/full/etool16/new_testcase.gif"
category="org.eclipse.jdt.ui.java/org.eclipse.jdt.junit"
id="org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard">
<class
class="org.eclipse.jdt.internal.junit.wizards.NewTestCaseCreationWizard">
</class>
<description>
%TestWizard.description
</description>
</wizard>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<newWizardShortcut
id="org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard">
</newWizardShortcut>
</perspectiveExtension>
</extension>
这篇关于如何在右键单击new-> MyNewMenu eclipse上添加弹出菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!