blob: 4f1dd000f3e96c4a1d7c4be399bef7f0a8a9d542 [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= DevFaqGetShortCutForAction
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqGetShortCutForAction
:description: Apache NetBeans wiki DevFaqGetShortCutForAction
:toc: left
:toc-title:
:syntax: true
== How to get the shortcut/shortkey of an action at runtime?
For example
[source,java]
----
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 link:http://wiki.netbeans.org/DevFaqGetShortCutForAction[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.