| Adding accelerator keys (how?) [message #871468] |
Sun, 13 May 2012 20:28  |
Missing name Mising name Messages: 94 Registered: December 2010 |
Member |
|
|
Now, I'm pretty sure that the way I'm doing some view-specific actions isn't the currently accepted practice. This is what happens when the example apps are out of date, and most of the examples I found via searches were apparently old as well.
So, taking that into account...
How do I add accelerator keys to my actions?
I've tried setAccelerator() and that doesn't work.
I have several Views that extend ViewPart.
These add toolbar buttons like this:
IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
mAction1 = new MessageSPAMAction("DoStuff");
ActionContributionItem aci = new ActionContributionItem(mAction1);
aci.setMode(ActionContributionItem.MODE_FORCE_TEXT);
tbm.add(aci);
The action class is an internal class, like this:
private class DoStuffAction extends Action {
publicDoStuffAction( String text) {
super(text);
setImageDescriptor(email.Activator.getImageDescriptor("/icons/dostuff.ico"));
return;
}
@Override
public void run() {
// Do things using member variables of the enclosing view
return;
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.01560 seconds