Apache NetBeans Wiki Index

Note: These pages are being reviewed.

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

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqGetShortCutForAction , that was last modified by NetBeans user Markiewb on 2016-03-27T14:05:30Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.