Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 90
Registered: ‎10-13-2015
Accepted Solution

Using keyboard shortcuts for @Action in GMSC in Java plugins

Hi all,

 

I would like to ask you for the small help ... I would like to register the keyboard shortcuts to my @Action in Java plugin in GMSC.

We found somewhere in examples that the action can have the parameter shortCut. I wrote the code in example and add shortCut parameter, but it does not react to the keyboard shortcut. Probably there is something missing.

 

@Plugin(id = "020205e1-3715-484b-bf80-9cf6c3d7e162", alias = "openInBrowserWithParameters", vendor = "Intergraph CZ")
public class OpenBrowserWithParameters extends AbstractPlugin{

	@Action(shortCut = "Ctrl Shift k", conditions={@Condition(actionCondition = KNUKMActionConditionFactory.class)})
	public void openInBrowserWithParameters(final RPAction action) throws Exception
	{		

The whole solution in Eclipse is in attachment.

 

Thanks!

 

Technical Evangelist
Posts: 148
Registered: ‎10-20-2015

Re: Using keyboard shortcuts for @Action in GMSC in Java plugins

Hi Jakub,

we are using the static KeyStroke.getKeyStroke(String s) method to get the corresponding KeyStrokte instance. Did you tried to use lowercase values instead of camel case?

 

  

@Plugin(id = "020205e1-3715-484b-bf80-9cf6c3d7e162", alias = "openInBrowserWithParameters", vendor = "Intergraph CZ")
public class OpenBrowserWithParameters extends AbstractPlugin{
 
	@Action(shortCut = "ctrl shift k", conditions={@Condition(actionCondition = KNUKMActionConditionFactory.class)})
	public void openInBrowserWithParameters(final RPAction action) throws Exception
	{		

 

Best Regards,

Steve

Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: Using keyboard shortcuts for @Action in GMSC in Java plugins

[ Edited ]

Hi Steve,

 

thanks for your reply. But unfortunately it doesn't help - the same behavior as before.

 

Project Eclipse.PNG

 

Isn't it necessary to add something into the META-INF/services folder, something like register IActionConditionFactory?

 

One more additional information, if I use shortcut "ctrl + shift + e" - it starts editing of geometry.

 

 

Community Manager
Posts: 173
Registered: ‎10-09-2015

Re: Using keyboard shortcuts for @Action in GMSC in Java plugins

Hi Jakub,

just did a quick test and I guess it is a casing issue. 

It must be ctrl shift K and not ctrl shift k --> as you use shift you must also use upper case. 

Here the working sample (based on your initial one):

@Plugin(alias="ActionTest", vendor="Hex Geo")
public class ActionTest extends AbstractPlugin
{
	
	@Action(shortCut="ctrl shift K", actionLocation=ActionLocation.MENUBARFAVORITS, conditions={@Condition(actionCondition = TestActionConditionFactory.class)})
	public void showActionParamters(final RPAction action)
	{
            //put some code here
	
	}
}

As you are using a custom action condition you have to register the condition factory but this has nothing to do with the shortcut. 

 

Hope this helps and if so, I am happy if you mark the answer as solution ;-)

 

Regards

Thomas

Thomas Anzinger
Community Manager
thomas.anzinger@hexagongeospatial.com
Technical Evangelist
Posts: 148
Registered: ‎10-20-2015

Re: Using keyboard shortcuts for @Action in GMSC in Java plugins

[ Edited ]

Small things can make a huge difference - the lower-case 'e' was my mistake, sorry Smiley Wink

Highlighted
Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: Using keyboard shortcuts for @Action in GMSC in Java plugins

Perfect guys, small "k" does not equal big "K" Smiley Sad That makes sense in combination with shift ...

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.