Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » ActiveMenuSelection and keybindings question/problem
icon5.gif  ActiveMenuSelection and keybindings question/problem [message #726695] Mon, 19 September 2011 09:45 Go to next message
Alexandra Niculai is currently offline Alexandra NiculaiFriend
Messages: 84
Registered: July 2009
Member
Hello,

In my app, I have declared this command

      <handler
            class="my.commands.edition.CreateNewFolderHandler"
            commandId="my.commands.edition.createNewFolder">
         <activeWhen>
            <with
                  variable="activePartId">
               <or>
                  <equals
                        value="my.views.methods.MyTreeView">
                  </equals>
               </or>
            </with>
         </activeWhen>
         <enabledWhen>
            <reference
                  definitionId="my.commands.edition.mayCreateFolderDef">
            </reference>
         </enabledWhen>
      </handler>


      <definition
            id="my.commands.edition.mayCreateFolderDef">
         <with
               variable="activeMenuSelection">
            <iterate
                  ifEmpty="true"
                  operator="or">
               <test
                     forcePluginActivation="true"
                     property="my.testers.edition.mayCreateFolder"
                     value="true">
               </test>
            </iterate>
         </with>
      </definition>


 <extension
         point="org.eclipse.ui.bindings">
      <key
            commandId="my.commands.edition.createNewFolder"
            contextId="org.eclipse.ui.contexts.window"
            schemeId="my.scheme"
            sequence="M1+ARROW_LEFT">
      </key>
 </extension>


I need this menu to show only as a pop-up so I made it check if it's enabled on "activeMenuSelection".
The problem is that in this case the keybinding doesn't work.
The keybinding does work when I replace "activeMenuSelection" with "selection" but I don't want this check to happen each time the user clicks on something in that tree because the methods that do the check go on a server and I have multiple commands in this tree. That would make my app a LOT less responsive.
Is there a way I can get the keybindings to work in these conditions? Do I have other options?
Thank you!

Alexandra.
Re: ActiveMenuSelection and keybindings question/problem [message #726802 is a reply to message #726695] Mon, 19 September 2011 15:25 Go to previous messageGo to next message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 111
Registered: July 2009
Location: Seoul
Senior Member

How did you expose your command as a menu item?
Re: ActiveMenuSelection and keybindings question/problem [message #726816 is a reply to message #726802] Mon, 19 September 2011 15:54 Go to previous message
Alexandra Niculai is currently offline Alexandra NiculaiFriend
Messages: 84
Registered: July 2009
Member
I added it like this:

   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="popup:org.eclipse.ui.popup.any">
         <command
               commandId="my.commands.edition.createNewFolder"
               label="%New_Folder"
               style="push">
            <visibleWhen
                  checkEnabled="true">
            </visibleWhen>
         </command>
      </menuContribution>
 </extension>
Previous Topic:Themes extension point
Next Topic:Can't see other jobs in progress dialog
Goto Forum:
  


Current Time: Fri Dec 19 01:47:31 GMT 2014

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

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