3

我正在为我们的开发环境开发基于 Eclipse 的定制 IDE。
在我的新视角中,我包含了一个“项目资源管理器”,并且可以在上下文菜单中添加命令,但是当我在“新”类型中包含一个新向导(A 项目向导)时,它显示在“项目”向导

CARD 文件应该在上面

我希望它高于它。

此片段的 plugin.xml 已附加

<extension point="org.eclipse.ui.navigator.navigatorContent">
      <commonWizard
              type="new"
              wizardId="dev.xxx.wizard.XXXProject">
              <enablement></enablement>
      </commonWizard>
</extension>

当我New从 Toolbar 或 MenuBar 访问时显示它(在我将它添加为布局中的快捷方式后,在IPerspectiveFactory的实现中

在此处输入图像描述

但由于某种原因,它没有出现在“项目资源管理器”下。但它在“导航器视图”下工作正常

在此处输入图像描述

4

3 回答 3

0

使用org.eclipse.ui.perspectiveExtensions扩展点newWizardShortcut为您的新项目向导定义一个条目。

就像是:

<extension
     point="org.eclipse.ui.perspectiveExtensions">
  <perspectiveExtension
        targetID="org.eclipse.jdt.ui.JavaPerspective">
     <newWizardShortcut
           id="org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard">
     </newWizardShortcut>
  </perspectiveExtension>

您可能需要执行“重置视角”才能获取更改。

您还可以在“快捷方式”选项卡的“窗口 > 自定义透视”对话框中设置这些快捷方式。

于 2015-06-18T09:22:43.717 回答
0

正如在 NewActionProvider.java 中提到的

“项目...”组中没有用于容纳“我的项目向导”的 menugroupid :(。

/**
 * Adds a submenu to the given menu with the name "group.new" see
 * {@link ICommonMenuConstants#GROUP_NEW}). The submenu contains the following structure:
 * 
 * <ul>
 * <li>a new generic project wizard shortcut action, </li>
 * <li>a separator, </li>
 * <li>a set of context senstive wizard shortcuts (as defined by
 * <b>org.eclipse.ui.navigator.commonWizard</b>), </li>
 * <li>another separator, </li>
 * <li>a generic examples wizard shortcut action, and finally </li>
 * <li>a generic "Other" new wizard shortcut action</li>
 * </ul>
 */

“项目资源管理器”的“新建”子菜单将始终采用这种格式,因此必须自己实现以将项目添加到项目组中。亲爱的格雷格,感谢您抽出宝贵时间。所以我要创建一个 NewActionProvider 的实现,如https://cvalcarcel.wordpress.com/tag/commonwizard/

于 2015-06-19T08:08:16.623 回答
0

使用标准ResourceNavigator(org.eclipse.ui.views.ResourceNavigator) 视图而不是ProjectExplorer.

在那里,新向导将自动分为项目向导和非项目向导,而前者会自动添加到与Project...向导相同的组中(无论menuGroupId设置什么,它们实际上都添加在其上方)。

因此,如果您想正确实现问题中所述的行为,您必须使用Navigator视图或扩展它。

(我知道这个问题是专门针对这个问题提出的,ProjectExplorer但我认为我的回答可能会对有类似问题的人有用)

于 2016-08-10T16:42:41.350 回答