| keybindings again: works for one user but not another [message #333317] | 
Wed, 03 December 2008 20:49   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: maggie.eclipse.gmail.com 
 
Hi, 
 
Searched through the archive, but didn't find a similar post to my problem. 
 
I'm trying to add a key binding for an existing command  
(com.foo.bar.command1) which can be invoked from the context menu of an  
editor or a selected resource in the Project Explorer. 
 
After added the following lines in my plugin.xml, the "Ctrl+C Ctrl+H"  
appears on the context menu next to the label of the command. 
      <key 
             commandId="com.foo.bar.command1" 
             contextId="org.eclipse.ui.contexts.window" 
             schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" 
             sequence="M1+C M1+H"> 
       </key> 
 
But it works only if I click the key binding in an editor. If I try to  
use the key bindings when select a resource in the Project Explorer,  
there is no effect. Selecting the menu item using mouse does invoke the  
command. 
 
A coworker tried this in her workspace, and it worked in both editor and  
  Project Explorer!! 
 
Would any environment setting impact the key binding behavior? Any idea  
what to check? 
 
This happens with Eclipse 3.3 on Linux. 
 
Thanks 
Maggie
 |  
 |  
  | 
 | 
| Project Explorer vs. Navigator [Re: keybindings again: works for one user but not another] [message #333359 is a reply to message #333335] | 
Thu, 04 December 2008 20:15   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: maggie.eclipse.gmail.com 
 
Hi Paul, 
 
Thanks for the useful tips. The answers to your questions are "yes". 
 
After further debugging, we realized that neither mouse click nor short  
cut work if the file is selected in CDT's Project Explorer. They both  
work fine in the Navigator view or the JDT's Package Explorer. 
 
This observation helped us to track down a bug in how we cast the  
selected element. In stead of static casting the selected element from  
Object to IFile, we should have done a dynamic casting using an Adapter. 
 
Now both short cut and mouse click work in CDT's Project Explorer perfectly. 
 
Thanks 
Maggie 
 
Paul Webster wrote: 
> It's always possible it might be a setting in your Window Manager  
> (assistive technologies activated, key bound to window function, etc). 
>  
> On thing you can do is to start up your eclipse with tracing turned on: 
>  http://wiki.eclipse.org/Platform_Command_Framework#Tracing_O ption 
>  
> Use com.foo.bar.command1 as the  
> org.eclipse.ui/trace/handlers.verbose.commandId 
>  
> That will tell you 1) if eclipse received the key events and 2) if it is  
> trying to invoke the handler. 
>  
> PW 
>  
>
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.04451 seconds