Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Adding accelerator keys (how?)
Adding accelerator keys (how?) [message #871468] Mon, 14 May 2012 00:28 Go to next message
John Lussmyer is currently offline John LussmyerFriend
Messages: 96
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;
        }
    }
Re: Adding accelerator keys (how?) [message #878171 is a reply to message #871468] Mon, 28 May 2012 18:39 Go to previous message
Simon Scholz is currently offline Simon ScholzFriend
Messages: 73
Registered: April 2012
Location: Germany
Member
Hello,

I would recommend to take a look at the Eclipse Commands.
Commands are newer than the Actions and they are loosely coupled from the UI.
See the following tutorial for further information:
www.vogella.com/articles/EclipseCommands/article.html

Best regards,

Simon
Previous Topic:Problem when running a RCP product
Next Topic:Stack view with editor in eclipse 3.5.
Goto Forum:
  


Current Time: Mon Dec 22 22:50:50 GMT 2014

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

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