Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » How to associate keyboard shortcuts with custom features?
How to associate keyboard shortcuts with custom features? [message #1099314] Sun, 01 September 2013 09:39 Go to next message
Surya Kathayat is currently offline Surya Kathayat
Messages: 42
Registered: July 2012
Member
Hi,

Can we associate keyboard shortcuts with custom features?

If yes, how it can be done.?

Best Regards
Surya
Re: How to associate keyboard shortcuts with custom features? [message #1100616 is a reply to message #1099314] Tue, 03 September 2013 06:46 Go to previous messageGo to next message
Felix Velasco is currently offline Felix Velasco
Messages: 41
Registered: July 2009
Member
Yes, you can.

See org.eclipse.graphiti.testtool.sketch plug-in for an example.

In the plugin.xml the key binding is created to the org.eclipse.graphiti.ui.featureExecutionCommand commandId, and in SketchToolBehavior#getCommandFeature, the custom feature to execute is selected. The hint parameter let's you select the specific feature so you can use different bindings for different features.

Since this approach uses the command infrastructure, it can be used for key bindings, menu entries, toolbar buttons, etc...
Re: How to associate keyboard shortcuts with custom features? [message #1141878 is a reply to message #1100616] Thu, 17 October 2013 04:48 Go to previous messageGo to next message
Surya Kathayat is currently offline Surya Kathayat
Messages: 42
Registered: July 2012
Member
Hi,

There is no getCommandFeature method in DefaultToolBehaviorProvider.
Which version of Graphitti that you are using?

Best Regards
Surya
Re: How to associate keyboard shortcuts with custom features? [message #1141879 is a reply to message #1100616] Thu, 17 October 2013 04:50 Go to previous messageGo to next message
Surya Kathayat is currently offline Surya Kathayat
Messages: 42
Registered: July 2012
Member
Hi

There is no getCommandFeature method available in DefaultToolBehaviorProvider.
Which version of Graphitti you are using?

Best Regards
Surya
Re: How to associate keyboard shortcuts with custom features? [message #1143635 is a reply to message #1141879] Fri, 18 October 2013 06:14 Go to previous message
Felix Velasco is currently offline Felix Velasco
Messages: 41
Registered: July 2009
Member
It got added in 0.10.0, but if you're using an older version you may add this functionality to your own plugin. Just see commit bf0cfafed440a4cea.

You'd need to define your own command, and provide a handler similar to FeatureExecutionHandler, but probably hardcoded to the specific feature you want to invoke.
Previous Topic:Add connection without palette
Next Topic: CASE-Tool and Code Generation (NON-EMF)
Goto Forum:
  


Current Time: Wed Apr 16 16:10:35 EDT 2014

Powered by FUDForum. Page generated in 0.02246 seconds