Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » JFace action accelerators interfering with typing
JFace action accelerators interfering with typing [message #671555] Wed, 18 May 2011 09:51 Go to next message
Patrick  is currently offline Patrick Friend
Messages: 2
Registered: May 2011
Junior Member
I have an application with a lot of jface actions (on a toolbar and in a menu) with accelerators, some of them single keys (e.g. just 'A'). However, when typing, say renaming an object (not modally) they interfere because when you try to type an A the action with that accelerator is activated, plus the A is not typed.

Is there a way to disable them temporarily? Or maybe you have another solution? I searched around but couldn't find anything. Also, settings the accelerators to 0 temporarily doesn't work because that call doesn't seem to do anything after the action constructor.

Thank you in advance.
Re: JFace action accelerators interfering with typing [message #671621 is a reply to message #671555] Wed, 18 May 2011 14:01 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

In general, it's a best practice to not use single letters for accelerators, for exactly the problem you describe ... the OS gets first pass at the key press, and consumes it.

If this is a JFace app (as opposed to an RCP app) then I guess it's either accelerators, mnemonics, or set up the Binding system yourself.

1) To use mnemonics, include '&' in the MenuManager text and action text. Then accessing most main menu items is a 2 stroke key sequence, like ALT+F N for New.

2) If you want the accelerator change to be noticed, keep the ActionContributionItem for the action you place in the MenuManager. Then:

action.setAccelerator(0);
actionCI.update(IAction.TEXT)


3) Setting up the binding system (the last option) is much harder than either of the above 2 options.

PW


Re: JFace action accelerators interfering with typing [message #671834 is a reply to message #671621] Thu, 19 May 2011 06:38 Go to previous message
Patrick  is currently offline Patrick Friend
Messages: 2
Registered: May 2011
Junior Member
Thank you, a very clear answer.

I'll try using the second option.
Previous Topic:Table Viewer - Entering any character on the key board would produce a beep sound
Next Topic:Download JFace
Goto Forum:
  


Current Time: Wed Apr 24 20:59:24 GMT 2024

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

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

Back to the top