Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Wwitch between Groups of Key Bindings Dynamically
Wwitch between Groups of Key Bindings Dynamically [message #333088] Tue, 25 November 2008 11:04 Go to next message
kent gibson is currently offline kent gibsonFriend
Messages: 114
Registered: July 2009
Senior Member
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
Re: Wwitch between Groups of Key Bindings Dynamically [message #333139 is a reply to message #333088] Wed, 26 November 2008 18:49 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

What are you trying to do, anyway? A local BindingManager is useful if
you are writing the equivalent of the keybinding preference page. But
it requires a lot of setup before it works correctly.

Take a look at
org.eclipse.ui.internal.keys.model.KeyController.loadModelBa ckend(IServiceLocator)
which takes tries to fill in a blank BindingManager from the
IBindingService.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:how to terminate new process created via Runtime.exec()
Next Topic:How to remove/replace the default key binding scheme
Goto Forum:
  


Current Time: Thu Dec 26 22:24:49 GMT 2024

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

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

Back to the top