Skip to main content



      Home
Home » Eclipse Projects » JFace » JFace action accelerators interfering with typing
JFace action accelerators interfering with typing [message #671555] Wed, 18 May 2011 05:51 Go to next message
Eclipse UserFriend
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 10:01 Go to previous messageGo to next message
Eclipse UserFriend
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 02:38 Go to previous message
Eclipse UserFriend
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 Jul 23 13:34:48 EDT 2025

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

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

Back to the top