Skip to main content



      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 05:45 Go to next message
Eclipse UserFriend
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 11:25 Go to previous messageGo to next message
Eclipse UserFriend
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 11:54 Go to previous message
Eclipse UserFriend
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: Sat Jul 12 17:11:09 EDT 2025

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

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

Back to the top