Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Bespoke Keybinding
Bespoke Keybinding [message #464254] Wed, 28 February 2007 23:05 Go to next message
Roger Nye is currently offline Roger NyeFriend
Messages: 67
Registered: July 2009
Member
Hi,
I am contributing actions through an actionSet extension point and want to
add key binding, using my own context and scheme.
From all the reference materials in Help and this newsgroup I have
produced the following, but it still doesn't work. The menus appear and
work, but not the keybindings.

1. definitionId in action matches commandId in bindings key and id in
commands command. (file.exit)
2. schemeId in binding key matches id in binding scheme (defaultScheme)
3. schemeId is specified in plugin_customization.ini (in plug-in root
directory) by org.eclipse.ui/KEY_CONFIGURATION_ID=defaultScheme
4. The context id matches the contextId in bindings key (app.context)
5. Context is activated in postWindowOpen of WorkbenchWindowAdvisor by
contextService.activateContext("app.context");


Can anyone suggest what I am missing please?
Are all these steps necessary (apart from using the deprecated approaches)?

I am using Eclipse 3.2.1.

Can anyone suggest what I am missing please?

Thanks
Roger


PS. Here are some extracts from plugin.xml:

ACTION SET--------------------------------------------------------- -
<extension
point="org.eclipse.ui.actionSets">
<actionSet
description="Main actionset for global menus and toolbar"
id="app.global"
label="Global Menu ActionSet"
visible="true">
<menu
id="menu.file"
label="%Menu.File"
path="file">
<groupMarker name="exit"/>
</menu>
<action
class="ch.actuary.app.actions.FileExitDelegate"
definitionId="file.exit"
id="file.exit"
label="%Menu.File.Exit"
menubarPath="menu.file/exit"
style="push"/>
...

BINDINGS---------------------------------------------------- ---------------
<extension
point="org.eclipse.ui.bindings">
<key
commandId="file.exit"
contextId="app.context"
schemeId="defaultScheme"
sequence="ALT+F4"/>
<scheme
id="defaultScheme"
name="Default Accelerator Scheme"/>
</extension>

COMMANDS---------------------------------------------------- --------------
<extension
point="org.eclipse.ui.commands">
<command
id="file.exit"
name="Exit"/>
...

CONTEXTS---------------------------------------------------- --------------
<extension
point="org.eclipse.ui.contexts">
<context
id="app.context"
name="Global App Context"/>
</extension>
Re: Bespoke Keybinding [message #464271 is a reply to message #464254] Thu, 01 March 2007 10:47 Go to previous messageGo to next message
Roger Nye is currently offline Roger NyeFriend
Messages: 67
Registered: July 2009
Member
It appears that the default scheme is not being picked up.
It works if I put a activeKeyConfiguration into the commands extension,
but this is deprecated.

Is there a better way of getting the scheme recognised?
Or do I have to do something for plugin_customization.ini to be read?
Re: Bespoke Keybinding [message #465223 is a reply to message #464271] Mon, 26 March 2007 14:49 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

it has to be specified as a <property/> element in your product for
eclipse to pick it up(I forget the exact syntax), or specified in the
command line: -plugincustomization myCustomDefaults.ini

The other thing I would mention is you probably want to tie your context
to a parent of dialogAndWindows, dialog, or windows (all with
org.eclipse.ui.contexts).

Later,
PW


Re: Bespoke Keybinding [message #465254 is a reply to message #464254] Tue, 27 March 2007 05:12 Go to previous message
Gavin Bong is currently offline Gavin BongFriend
Messages: 23
Registered: July 2009
Junior Member
What I did to solve this is to export it as a product. Then the keybindings show up. If you fire up your RCP from the eclipse IDE itself, it will default to using the scheme "org.eclipse.ui.defaultAcceleratorConfiguration".

You can track what scheme is being used by executing this within your RCP.

IWorkbench workbench = PlatformUI.getWorkbench();
IBindingService service = ( IBindingService ) workbench.getService( IBindingService.class );
Scheme tScheme = service.getActiveScheme();

Regards,

Gavin
Previous Topic:(objectContribution to popupMenu) ordering the menu items
Next Topic:Handle on File or IFile
Goto Forum:
  


Current Time: Thu Apr 18 23:55:16 GMT 2024

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

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

Back to the top