首页 文章

如何在eclipse上右键单击new-> MyNewMenu添加弹出菜单?

提问于
浏览
0

我试着创建一个eclipse插件......但是如何在新的上下文中添加一个新的弹出菜单呢?

例如,我右键单击项目并将我的菜单放在New-> MyNewMenu中

在菜单File-New上添加一个新项目我正在使用它

<extension
     point="org.eclipse.ui.menus">
  <menuContribution
        locationURI="menu:new?after=additions">
     <menu
           id="Test1.menus.sampleMenu"

但是如果我尝试弹出:menu:new?after =在locationURI上添加这不起作用...

当我使用RCP eclipse的Spy插件知道返回的弹出ID时

menu:null?after=additions

我怎么解决这个问题?

1 回答

  • 1

    要在“文件”>“新建”菜单中获取内容,必须使用 org.eclipse.ui.newWizards 扩展点来定义“新建”向导 . 这将使新向导出现在'Other...'部分中 .

    要添加到“新建”菜单主要部分中显示的新向导列表,必须使用 org.eclipse.ui.perspectiveExtensions 扩展点为新向导定义 newWizardShortcut .

    JDT JUnit插件中新向导和快捷方式的示例:

    <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>
    

相关问题