Apache NetBeans
Apache NetBeans
Latest release

Apache NetBeans 23

Download

How to get the shortcut/shortkey of an action at runtime?

For example

Action action = FileUtil.getConfigObject("Actions/Source/org-netbeans-modules-editor-hints-FixAction.instance", Action.class);
KeyStroke ks = action != null ? (KeyStroke) action.getValue(Action.ACCELERATOR_KEY) : null;


// localise a keystroke for display
org.openide.util.Utilities.keyToString() // or
org.netbeans.core.options.keymap.api.KeyStrokeUtils.getKeyStrokeAsText() // if a friend of org.netbeans.modules.options.keymap