Keybinding [message #464428] |
Sun, 04 March 2007 22:10  |
Eclipse User |
|
|
|
Hi everyone,
I want to know how do I define a key binding for action, and make it
dynamically configuration during the runtime. So what i have done so far
in my app, i have defined a command and associates a key binding to this
command. During the initialization, i have used IKeyBindingService to
register an action that has setActionDefId to the command id. so far, it
is working. and my question is am i doing it correctly, and how do i make
the key sequence configurable like the Preference->General->Keys in
Eclipse.
|
|
|
Re: Keybinding [message #465225 is a reply to message #464428] |
Mon, 26 March 2007 10:55  |
Eclipse User |
|
|
|
If you've used org.eclipse.ui.commands and org.eclipse.ui.bindings to
define the initial keybinding, then you can use:
IHandlerService s
= (IHandlerService) getSite().getService(IHandlerService.class);
s.activeHandler("commandId", handler);
handler can either be the AbstractHandler implementation of your action
or an ActionHandler (which wraps an IAction).
If you want to allow users to go back and configure it, you can include
the keys preference page (old or new).
Later,
PW
|
|
|
Powered by
FUDForum. Page generated in 0.05633 seconds