[英]Eclipse RCP: How to add a new element to a default Java dropdown menu in the toolbar(New Java Class)
I'm making an RCP application. 我正在申请RCP。 I need to change the 'New Java Class' dropdown menu:
我需要更改“新Java类”下拉菜单:
to have an extra element (it is used to create a new custom application). 具有额外的元素(用于创建新的自定义应用程序)。
Also I need to change the default 'New Java Class' button to this new custom application element. 另外,我需要将默认的“ New Java Class”按钮更改为此新的自定义应用程序元素。
I couldn't find the required IDs to extend this dropdown menu in the plugin.xml. 我在plugin.xml中找不到扩展此下拉菜单所需的ID。 My current solution is to create a completely new menuContribution in the toolbar and somehow hide the old one.
我当前的解决方案是在工具栏中创建一个全新的menuContribution,并以某种方式隐藏旧菜单。 But I think it should be possible to add a new command to the already existing one.
但是我认为应该可以向现有命令添加新命令。
That drop down menu is implemented by the org.eclipse.jdt.internal.ui.wizards.NewTypeDropDownAction
class. 该下拉菜单由
org.eclipse.jdt.internal.ui.wizards.NewTypeDropDownAction
类实现。
The code reads through the list of New Wizards declared using the org.eclipse.ui.newWizards
extension point. 该代码通读使用
org.eclipse.ui.newWizards
扩展点声明的“新向导”列表。 Only new wizards which declare the class
using a child element which itself includes a parameter
child element with a value of javatype
are used. 仅使用使用子元素声明
class
新向导,该子元素本身包括带有javatype
值的parameter
子元素。
This is the 'Interface' wizard declaration using this format: 这是使用以下格式的“接口”向导声明:
<wizard
name="%NewJavaInterface.label"
icon="$nl$/icons/full/etool16/newint_wiz.png"
category="org.eclipse.jdt.ui.java"
id="org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard">
<class class="org.eclipse.jdt.internal.ui.wizards.NewInterfaceCreationWizard">
<parameter name="javatype" value="true"/>
</class>
<description>
%NewJavaInterface.description
</description>
<keywordReference id="org.eclipse.jdt.ui.wizards.java"/>
</wizard>
The 该
<class class="org.eclipse.jdt.internal.ui.wizards.NewInterfaceCreationWizard">
<parameter name="javatype" value="true"/>
</class>
section is the part that the drop down is looking for. 部分是下拉菜单所要寻找的部分。
This format doesn't actually seem to be documented in the Eclipse help. 实际上,Eclipse帮助中似乎没有记录这种格式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.