【问题标题】:Eclipse plugin project explorer context menuEclipse 插件项目资源管理器上下文菜单
【发布时间】:2014-06-22 08:37:39
【问题描述】:

这是 PackageExplorer 的 plugin.xml 工作上下文菜单的一部分,现在我想要它用于 ProjecExplorer,所以我尝试将其重写为 ProjectExplorer 但它不起作用.. 我在网上搜索并发现有问题,但是我找不到有效的解决方案。有没有人遇到过如何修复它?

    <extension point="org.eclipse.ui.menus">
    <menuContribution locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
      <command commandId="app.LoadXml"
        label="Load plan" style="push" mnemonic="L">
         <visibleWhen>
                <with variable="activeMenuSelection">
                    <iterate ifEmpty="false">
                        <adapt type="org.eclipse.core.resources.IResource">
                                <test property="org.eclipse.core.resources.name" value="*.xml" />
                        </adapt>
                    </iterate>
                </with>
         </visibleWhen>
      </command>
    </menuContribution>
  </extension>

我不工作的解决方案 - 将 PackageExploer 重命名为 ProjectExplorer => 现在是上下文菜单。

<extension point="org.eclipse.ui.menus">
    <menuContribution locationURI="popup:org.eclipse.jdt.ui.ProjectExplorer">
      <command commandId="app.LoadXml"
        label="Load plan" style="push" mnemonic="L">
         <visibleWhen>
                <with variable="activeMenuSelection">
                    <iterate ifEmpty="false">
                        <adapt type="org.eclipse.core.resources.IResource">
                                <test property="org.eclipse.core.resources.name" value="*.xml" />
                        </adapt>
                    </iterate>
                </with>
         </visibleWhen>
      </command>
    </menuContribution>
  </extension>

【问题讨论】:

    标签: eclipse eclipse-plugin contextmenu


    【解决方案1】:

    第二部分使用的位置 URI 错误。

    locationURI="popup:org.eclipse.jdt.ui.ProjectExplorer"

    查看here

    项目资源管理器 org.eclipse.ui.navigator.ProjectExplorer 项目 org.eclipse.jdt.ui.ProjectsView

    【讨论】:

      猜你喜欢
      • 2017-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多