Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Commands triggered by a key stroke
Commands triggered by a key stroke [message #248612] Fri, 24 April 2009 10:44 Go to next message
Rodrigo Garcia is currently offline Rodrigo GarciaFriend
Messages: 14
Registered: July 2009
Junior Member
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 15:14 Go to previous messageGo to next message
Rodrigo Garcia is currently offline Rodrigo GarciaFriend
Messages: 14
Registered: July 2009
Junior Member
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 16:31 Go to previous message
Ben Vitale is currently offline Ben VitaleFriend
Messages: 247
Registered: July 2009
Senior Member
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: Thu Apr 18 12:03:59 GMT 2024

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

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

Back to the top