Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » dropdown with toolbar (can't get a pulldown to work as described in http://wiki.eclipse.org/Menu_Contributions/Dropdown_Command)
dropdown with toolbar [message #515630] Fri, 19 February 2010 10:05 Go to next message
Alan Chaney is currently offline Alan Chaney
Messages: 20
Registered: January 2010
Junior Member
I'm trying to use the o.e.ui.menus api to manage some commands in the workbench toolbar.

I found http://wiki.eclipse.org/Menu_Contributions/Dropdown_Command which seems to explain exactly what I want to do.

Here's my extension declarations.

   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
         <toolbar
               id="x.y.z.toolbar">
            <command
                  commandId="x.y.z.command.zoomIn"
                  label="Zoom In"
                  style="push">
            </command>
            <command
                  commandId="x.y.z.command.zoomOut"
                  label="Zoom Out"
                  style="push">
            </command>
            <command                                                                           
                  commandId="x.y.z.command.pulldown.transform"         <== ALWAYS DISABLED
                  icon="icons/sample.gif"
                  id="x.y.z.command.pulldown.transform"
                  tooltip="Flip/Rotate"
                  style="pulldown">
             </command>
          <command
               commandId="x.y.z.command.rotatecw90"                             <== WORKS
               style="push">
          </command>
         </toolbar>
      </menuContribution>
    </extension>
    <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:x.y.z.command.pulldown.transform">
         <command
               commandId="x.y.z.command.rotatecw90"  <== duplicate of working command
               style="push">
          </command>
         <command
               commandId="x.y.z.command.fliphoriz"
               style="push">
         </command>
         <command
               commandId="x.y.z.command.flipvert"
               style="push">
         </command>
      </menuContribution>
   </extension>
    <extension
         point="org.eclipse.ui.commands">
  <!--  ... lots of other commands that work -->
     <command
            description="Operations to rotate or flip"
            id="x.y.z.command.pulldown.transform"
            name="RotateFlip">
      </command>
   </extension>


I haven't included the handler and the other command definitions because when the commands as above are invoked from the main menu or a context menu or even the toolbar itself they work fine. However, when I run my app with the definition as above the actual dropdown icon (sample.gif) just stays disabled. What am I doing wrong? As far as I can see, I've copied the relevant portions of the article.

Regards

Alan Chaney


Re: dropdown with toolbar [message #515695 is a reply to message #515630] Fri, 19 February 2010 14:44 Go to previous message
Alan Chaney is currently offline Alan Chaney
Messages: 20
Registered: January 2010
Junior Member
And I found the answer!

There's nothing wrong with what I posted *except* that the command for the pulldown must be actually enabled! Doh!

After I changed the command associated with the pulldown to the first command in the list (in other words, the "default" ) it worked fine!

Never mind...

[Updated on: Fri, 19 February 2010 14:44]

Report message to a moderator

Previous Topic:How to get rid of WARNING: prevented recursive attempt to activate part org.eclipse.ui.views.Propert
Next Topic:Re: IToggleBreakpointsTarget.toggleLineBreakpoints not called
Goto Forum:
  


Current Time: Wed Aug 20 06:58:22 EDT 2014

Powered by FUDForum. Page generated in 0.01990 seconds