Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Key bindings: "overwrite" existing binding, define own context for view, activate it
Key bindings: "overwrite" existing binding, define own context for view, activate it [message #306072] Wed, 19 July 2006 18:32
Eclipse UserFriend
Hello,
I want to add a action to a view, which works similar to the action
"Press 'F2' for focus" in the JDT information popup dialog. The problem
that I have is, that the key F2 is already bound to the "renaming".

For this purpose I defined a context (see below), and activate it in my
view. Anyways, if my view is in focus, the context is apparently not
changed correctly or there might be an error with the inheritance of key
bindings.
How can I properly define and activate a context? Thank you!

The code in the view:
....
IContextService contextService =
(IContextService)this.getSite().getService(IContextService.c lass);
contextService.activateContext("ca.uvic.cs.segal.visualization.scope ");

showLongDescAction.setActionDefinitionId("ca.uvic.cs.segal.visualization.longDescAction ");
IHandlerService handlerService =
(IHandlerService)this.getSite().getService(IHandlerService.c lass);

handlerService.activateHandler(showLongDescAction.getActionD efinitionId(),
new ActionHandler(showLongDescAction));
....

The plugin.xml:

<extension
point="org.eclipse.ui.contexts">
<context
id="ca.uvic.cs.segal.visualization.scope"
name="Requirements Explorer Plugin"
/>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="ca.uvic.cs.segal.visualization.longDescAction"
contextId="ca.uvic.cs.segal.visualization.scope"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="F2"/>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
categoryId="ca.uvic.cs.segal.visualization"
description="Show popup with detailed description"
id="ca.uvic.cs.segal.visualization.longDescAction"
name="Show details"/>
<category
description="Command used in the visualization of the
Requirements Explorer"
id="ca.uvic.cs.segal.visualization"
name="Requirements Explorer Visualization"/>
</extension>
Previous Topic:Adding "Help" menu items in the manifest
Next Topic:Finding the classloader from a bundle
Goto Forum:
  


Current Time: Wed Jul 23 08:11:39 EDT 2025

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

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

Back to the top