Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Problem to add a menu contribution in projet explorer(MenuContribution in ProjectExplorer view)
Problem to add a menu contribution in projet explorer [message #651626] Mon, 31 January 2011 23:33 Go to next message
michel Labarre is currently offline michel LabarreFriend
Messages: 7
Registered: July 2009
Junior Member
Hello
I have added a menu contribution in PackageExplorer. It appears correctly (first menuContribution in the following XML). Then I try add to do the same thing into Project Explorer (second menuContribution) but item doesn't appears (with or without visibleWhen tag). I have read all infos on google but I have not found solution.
Below an extract of my plugin xml.
Can have any help?

<extension
         point="org.eclipse.ui.menus">
    <menuContribution
            locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
        <command
            commandId="myCommandId"
            icon="icons/wizard.gif"
            id="myId"
            label="My choice"
            style="push">
            <visibleWhen>
                <with
                     variable="activeMenuSelection">
                    <iterate>
                        <adapt
                           type="org.eclipse.jdt.core.IPackageFragment">
                        </adapt>
                    </iterate>
                </with>
            </visibleWhen>
        </command>
    </menuContribution>
    <menuContribution 
       locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu?after=additions">
        <command
            commandId="myCommandId"
            icon="icons/wizard.gif"
            id="myId"
            label="My choice"
            style="push">
            <visibleWhen>
                <with
                    variable="activeMenuSelection">
                    <iterate>
                        <adapt
                           type="org.eclipse.jdt.core.IPackageFragment">
                        </adapt>
                    </iterate>
                </with>
            </visibleWhen>
        </command>
    </menuContribution>
</extension>

Re: Problem to add a menu contribution in projet explorer [message #651730 is a reply to message #651626] Tue, 01 February 2011 12:57 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 01/31/2011 06:33 PM, michel wrote:
> Hello I have added a menu contribution in PackageExplorer. It appears
> correctly (first menuContribution in the following XML). Then I try add
> to do the same thing into Project Explorer (second menuContribution) but
> item doesn't appears (with or without visibleWhen tag). I have read all
> infos on google but I have not found solution.
> Below an extract of my plugin xml.


can you get the menu item to show up if you don't include the
visibleWhen? If not, please open a bug with your snippet at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Problem to add a menu contribution in projet explorer [message #651870 is a reply to message #651626] Tue, 01 February 2011 20:35 Go to previous messageGo to next message
michel Labarre is currently offline michel LabarreFriend
Messages: 7
Registered: July 2009
Junior Member
Same problem without VisibleWhen condition.
I open a bug
Thank you
Re: Problem to add a menu contribution in projet explorer [message #760914 is a reply to message #651870] Mon, 05 December 2011 15:17 Go to previous messageGo to next message
paolocollector is currently offline paolocollectorFriend
Messages: 1
Registered: October 2011
Junior Member
I am facing the same problem with Helios
Can you post the ref. to the issue so that we can check for a fix or a workaround?
thanks
Re: Problem to add a menu contribution in projet explorer [message #893465 is a reply to message #651626] Wed, 04 July 2012 08:51 Go to previous messageGo to next message
Ankit Dhir is currently offline Ankit DhirFriend
Messages: 1
Registered: July 2012
Junior Member
use the following
targetID="org.eclipse.ui.navigator.ProjectExplorer#PopupMenu"

<extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
id="com.ibm.examples.AddDiagramContribution"
targetID="org.eclipse.ui.navigator.ProjectExplorer#PopupMenu">
<visibility>
<and>
<objectState name="isSingleSelection" value="visibility"/>
<or>
<objectState name="umlStrictType" value="Model"/>
<objectState name="umlStrictType" value="Package"/>
</or>
</and>
</visibility>
<action
label="My Diagram Label"
icon="icons/myDiagramIcon.gif"
class="com.ibm.examples.actions.AddDiagramActionDelegate"
menubarPath="com.ibm.xtools.modeler.ui.actions.AddDiagramMenu/additions"
enablesFor="1"
id="myActionId">
</action>
</viewerContribution>
</extension>

Re: Problem to add a menu contribution in projet explorer [message #1022903 is a reply to message #893465] Fri, 22 March 2013 19:04 Go to previous message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 70
Registered: January 2013
Member
I am having the same problem in Eclipse Indigo 3.7. I removed after=additions too, but still cannot see the menu item in project explorer popup, while I can see it in the editor popup. Is this the right location URL? Is there anywhere to find default location URL's?

Thanks in advance!
Previous Topic:Headless PDE build fails for platform specific plugins
Next Topic:EditorPart change composite
Goto Forum:
  


Current Time: Fri Nov 28 03:38:34 GMT 2014

Powered by FUDForum. Page generated in 0.01659 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software