Skip to main content



      Home
Home » Eclipse Projects » GEF » Commands triggered by a key stroke
Commands triggered by a key stroke [message #248612] Fri, 24 April 2009 06:44 Go to next message
Eclipse UserFriend
Hi,

I want to execute a command triggered by a key stroke. This command will
create a child figure and only could be triggered if the parent figure is
selected.

what would be the better way to do that?

I've been thinking to addKeyListener to the parent figure, but I suppose
that the command should be instantiated in the apropiated EditPart.

Any idea?

Thank you in advance.
Re: Commands triggered by a key stroke [message #248700 is a reply to message #248612] Mon, 27 April 2009 11:14 Go to previous messageGo to next message
Eclipse UserFriend
Should I have to add a keyHandler to EditPartViewer?

How is used the addKeyListener in figures?

Thanks
Re: Commands triggered by a key stroke [message #248738 is a reply to message #248700] Wed, 29 April 2009 12:31 Go to previous message
Eclipse UserFriend
Yes, you'll want a KeyHandler set on your EditPartViewer. Then you can
map an IAction to a particular keystroke using:

org.eclipse.gef.KeyHandler.put(KeyStroke keystroke, IAction action)

Your Action would take care of executing the command on the command stack.

For a full example, check out how the DeleteAction is hooked into the
Logic example.

Regards,
Ben

roeclipse wrote:
> Should I have to add a keyHandler to EditPartViewer?
>
> How is used the addKeyListener in figures?
>
> Thanks
>
Previous Topic:[Announce] GEF 3.5.0 I200904251850 is available
Next Topic:Repopulate RootEditPart on double-click
Goto Forum:
  


Current Time: Wed Mar 19 13:33:26 EDT 2025

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

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

Back to the top