By the way - sometimes it seems to me, that there must exists one secret URL containing complete and actual RCP documentation, which every developer - except me - knows.
Back to the problem - we were using older way (deprecated, but still functional) to specify key bindings in plugin.xml
<keyBinding
commandId="yournamespace.command.newempty"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="Ctrl+N" />
It works fine, but not for keys, that are normaly used by RCP (common shortcuts like Ctrl+N, Ctrl+S, etc.). This combinations needs to override (of course, you can implement the corresponding actions, but sometimes you may don't want to do that) the default RCP setting, but how?
The way I found is as follows:
1. Create some context for your app in plugin.xml:
<extension point="org.eclipse.ui.contexts">
<context id="yournamespace.context" name="Default Context"
parentid="org.eclipse.ui.contexts.window"
description="..."></extension>
2. Move problematic keybindings into this context (by specifying contextId in the keyBinding element):
<keyBinding
commandId="yournamespace.command.newempty"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="yournamespace.context"
keySequence="Ctrl+N" />
3. Active this context at run-time somewhere in the app init:
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
((IContextService) PlatformUI.getWorkbench()
.getService(IContextService.class))
.activateContext("yournamespace.context");
}
});
That's all folks. I suppose the command you have specified in commandId already exists (if not, create it). The same stands for action binded to this command.
Actually, not all actions are always specified in plugin.xml, but are created at runtime. Wiring this action (to command and its keybinding) through following methods worked for me.
undoAction.setId("yournamespace.action.undo");
undoAction.setActionDefinitionId("yournamespace.command.undo");
this.getActionBarConfigurer().registerGlobalAction(undoAction);
Hope this post might have helped someone. The presented solution isn't very clean, but functional for me. If you have something better, please feel free to post it here.