Accelarators for Actions [message #171411] |
Wed, 17 December 2003 03:29  |
Eclipse User |
|
|
|
Originally posted by: wyejon.lee.tokuii.com
Hi all,
I'm new to Eclipse. It's a great platform but the lack of documentation
is criminal :)
Cutting to the chase... I'm using 3.0M5 on Redhat 9. Excuse me if I use
the wrong terminology and feel free to correct me.
Using the Rich Client Platform (RCP) tutorial by Ed Burnette I have so far
created an almost totally empty workbench with absolutely no plugins
loaded except my default perspective with no views.
I've also created some actions and placed them in the workbench's menu bar
and toolbar. The thing I can't figure out is how to set the accelarator
for those actions.
For example, I want it so that when I type on Ctrl+B, I want my action to
be invoked and do it's stuff... i.e. an "About Dialog" pops up.
IAction.setAccelerator() is deprecated so I'd rather not use it (I'm not
even sure if it works in the first place). I did look at another thread,
something about Overriding the global shortcuts but I found that rather
confusing.
If I'm not asking for too much, a detailed explanation would be
appreciated. Thanks everyone.
|
|
|
|
Re: Accelarators for Actions [message #177387 is a reply to message #172332] |
Thu, 08 January 2004 16:20  |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
'&' sets the mnemonic that underlines a character in the word, allowing
you to press that letter and jump to that action. To get key bindings
to work, there are a couple of things you need to do:
1) Associate the action with a command (see javadoc of
org.eclipse.ui.commands extension point), by calling
Action.setActionDefinitionId.
2) Register the action as a global action with the platform. In an RCP
application there is a method on IActionBarConfigurer to do this:
public void fillActionBars(IWorkbenchWindow window,
IActionBarConfigurer configurer, int flags) {
configurer.registerGlobalAction(yourAction);
}
I agree there is currently no documentation, but this is still a very
early alpha build of RCP. The code is still in flux, so this may change
again before the first release (in Eclipse 3.0).
--
Daniel Megert wrote:
> Put a '&' in front of the desired accelerator character when setting the
> text/label.
>
> Dani
>
> Jon Lee wrote:
>
>> Hi all,
>>
>> I'm new to Eclipse. It's a great platform but the lack of documentation
>> is criminal :)
>>
>> Cutting to the chase... I'm using 3.0M5 on Redhat 9. Excuse me if I use
>> the wrong terminology and feel free to correct me.
>>
>> Using the Rich Client Platform (RCP) tutorial by Ed Burnette I have so
>> far
>> created an almost totally empty workbench with absolutely no plugins
>> loaded except my default perspective with no views.
>>
>> I've also created some actions and placed them in the workbench's menu
>> bar
>> and toolbar. The thing I can't figure out is how to set the accelarator
>> for those actions.
>>
>> For example, I want it so that when I type on Ctrl+B, I want my action to
>> be invoked and do it's stuff... i.e. an "About Dialog" pops up.
>>
>> IAction.setAccelerator() is deprecated so I'd rather not use it (I'm not
>> even sure if it works in the first place). I did look at another thread,
>> something about Overriding the global shortcuts but I found that rather
>> confusing.
>>
>> If I'm not asking for too much, a detailed explanation would be
>> appreciated. Thanks everyone.
>>
>>
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.27061 seconds