Wwitch between Groups of Key Bindings Dynamically [message #333088] |
Tue, 25 November 2008 11:04  |
Eclipse User |
|
|
|
IBindingServe says "If you are trying to switch between groups of bindings
dynamically, you should be using contexts.", how would one go about this?
I am trying to get my bindings and only my bindings to go into the
ctrl+shift+L cheat sheet.
I tried a couple of strategies and most of them resulted in an empty key
bindings cheat sheet.
For example I created my own scheme and my own BindingManager and then I
set the BindingManager scheme and at the end I called
bindingService.savePreferences.
Do I need to work with contexts? Or am I doing something else wrong?
This is essentially what I am doing:
###############
IBindingService bindingService = (IBindingService) PlatformUI
getWorkbench().getAdapter(IBindingService.class);
BindingManager localChangeManager = new BindingManager(
new ContextManager(), new CommandManager());
try {
Scheme scheme = bindingService.getScheme("newscheme");
localChangeManager.setActiveScheme(scheme);
} catch (final NotDefinedException e) {
throw new Error(
"There is a error"); //$NON-NLS-1$
}
try {
bindingService.savePreferences(
localChangeManager.getActiveScheme(), localChangeManager
.getBindings());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
#####
Perhaps I am defining the scheme wrong, when I do setActiveScheme, it
throws an exception about the parent identifier. Ideally I want to parent
identifier, but if set to org.eclipse.ui.defaultAcceleratorConfiguration,
I am getting the same problem.
this is my scheme:
<scheme
name="newscheme"
description="newscheme"
parentId = "org.eclipse.ui.defaultAcceleratorConfiguration"
id="newscheme"/>
thanks
|
|
|
|
Powered by
FUDForum. Page generated in 0.02564 seconds