11-06-2015 01:38 AM
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!
Solved! Go to Solution.
11-09-2015 01:47 AM
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
11-09-2015 02:07 AM - edited 11-09-2015 02:13 AM
Hi Steve,
thanks for your reply. But unfortunately it doesn't help - the same behavior as before.
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.
11-09-2015 03:25 AM
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
11-09-2015 03:30 AM - edited 11-09-2015 03:30 AM
Small things can make a huge difference - the lower-case 'e' was my mistake, sorry
11-09-2015 04:18 AM
Perfect guys, small "k" does not equal big "K" That makes sense in combination with shift ...