Pregunta

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>
¿Fue útil?

Solución

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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top