Eclipse plugin project explorer context menu

两盒软妹~` 提交于 2019-12-12 12:16:18

问题


This is part of plugin.xml working context menu for PackageExplorer now I wanted it for ProjecExplorer, so I tried rewrite it to ProjectExplorer but It doesn't work .. I searched the web and found that are problem with that, but I couldn't find working solution. Does anybony experience how to fix do it?

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

My not working solution - renamed PackageExploer to ProjectExplorer => now context menu.

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

回答1:


location URI used in the second part is wrong.

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

Check here

Project Explorer      org.eclipse.ui.navigator.ProjectExplorer

Projects              org.eclipse.jdt.ui.ProjectsView


来源:https://stackoverflow.com/questions/23482716/eclipse-plugin-project-explorer-context-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!