Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Adding accelerator keys (how?)
Adding accelerator keys (how?) [message #871468] Sun, 13 May 2012 20:28 Go to next message
Eclipse UserFriend
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 14:39 Go to previous message
Eclipse UserFriend
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: Sat Jul 05 05:28:01 EDT 2025

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

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

Back to the top