如何在项目资源管理器中右键单击时,将New-> File->其他创建的向导添加到弹出菜单中 [英] how to add Wizards created in New->File->others into popup menus when right click in project explorer
问题描述
我在 File-> New->其他中创建了一个类别,例如Enterprise。有一些向导可以让Instance,Component,等等
现在我想要的,当我右键单击项目资源管理器并进入新的这些向导应该被看到他们自己。基本上尝试使这些向导的弹出菜单。
I have created a category in File->New->Others say "Enterprise".With some Wizards in it lets say "Instance","Component", etc. Now what i want ,when i right click in Project Explorerand go in New those wizards should be seen their itself. Basically trying to make popup menu of those wizards.
所以我创建了弹出菜单:
So i created popup menus as:
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
locationURI="popup:common.new.menu?before=additions">
<command
commandId="CommandComponent"
label="Component"
style="push">
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="CommandComponent"
name="Component">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="CommandComponent">
</handler>
</extension>
现在我怎么能给同样的类给我给向导组件的处理程序?
Now how could I give the same class to the handler which I gave to Wizard Component?
或者我必须编写一个具有相同功能的新类,但是按照处理程序格式(如果可能)?
Or do I have to write a new class with the same functionality but as per handler format (if it is possible)?
推荐答案
您可以使用 org.eclipse.ui.perspectiveExtensions
扩展点来定义显示在顶层的新向导新菜单使用 newWizardShortcut
元素。
You use the org.eclipse.ui.perspectiveExtensions
extension point to define the New Wizards which are show at the top level of the New menu using the newWizardShortcut
element.
有些东西:
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.jdt.ui.JavaPerspective">
<newWizardShortcut
id="org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard">
</newWizardShortcut>
</perspectiveExtension>
(这是New JUnit测试用例快捷方式)。
(which is the New JUnit Test Case shortcut).
您可能需要重置透视图或使用自定义透视图使该项目可见,因为用户可以控制显示哪些快捷方式。
You may need to Reset the Perspective or use Customize Perspective to make the item visible as the user has control over which of these shortcuts is shown.
更多帮助中的信息
这篇关于如何在项目资源管理器中右键单击时,将New-> File->其他创建的向导添加到弹出菜单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!