| // |
| // 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. |
| // |
| |
| = DevFaqTweakRegistryByCodeReplacement |
| :jbake-type: wiki |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| |
| === How do I have only shortcut keys for an action? |
| |
| The *New Action* wizard allows you to uncheck both menu and toolbar placement for your action and only assign a keyboard shortcut. To learn how to do this manually, read on. |
| Refer to link:TaT_HackingNetBeansXMLLayerPartOne.html[TaT_HackingNetBeansXMLLayerPartOne] for more details. |
| |
| ==== Trick #1 |
| |
| * Retain the action's basic registration: |
| [source,xml] |
| ---- |
| |
| <folder name="Actions"> |
| <folder name="Tools"> |
| <file name="org-nvarun-tat-SayCheez.instance"/> |
| </folder> |
| </folder> |
| |
| ---- |
| |
| * This registers an action as a *Global Menu Item*: |
| [source,xml] |
| ---- |
| |
| <folder name="Menu"> |
| <folder name="Tools"> |
| <file name="org-nvarun-tat-SayCheez.shadow"> |
| <attr name="originalFile" |
| stringvalue="Actions/Tools/org-nvarun-tat-SayCheez.instance"/> |
| <attr name="position" intvalue="150"/> |
| </file> |
| </folder> |
| </folder> |
| |
| ---- |
| |
| * This registers an action as a *Global Toolbar Button*: |
| [source,xml] |
| ---- |
| |
| <folder name="Toolbars"> |
| <folder name="Build"> |
| <file name="org-nvarun-tat-SayCheez.shadow"> |
| <attr name="originalFile" |
| stringvalue="Actions/Tools/org-nvarun-tat-SayCheez.instance"/> |
| <attr name="position" intvalue="325"/> |
| </file> |
| </folder> |
| </folder> |
| |
| ---- |
| |
| * To assign a shortcut key, replace either or both of them with something like the following: |
| [source,xml] |
| ---- |
| |
| <folder name="Shortcuts"> |
| <file name="O-F3.shadow"> |
| <attr name="originalFile" |
| stringvalue="Actions/Tools/org-nvarun-tat-SayCheez.instance"/> |
| </file> |
| </folder> |
| |
| ---- |
| |
| ==== Trick #2 |
| |
| * In the above example the action has the shortcut key *Alt+F3*, which is represented as `O-F3`. In general, if you have some key combination that uses *Alt* (or the equivalent on Mac OS X), then use `O`. Separate modifiers from the base keycode name with `-`, and append `.shadow` for the filename. *Ctrl* (or its Mac equivalent) is represented by `D`, and *Shift*by `S`. (`C` and `A` represent the literal *Ctrl* and *Alt* keys, but this is less portable.) |
| |
| ==== Tips to Remember |
| |
| 1. Following are some keycode equivalents. See Javadoc for `KeyEvent` for the full list: |
| * *A* to *Z* (as is), *F1* to *F12* (as is), *0* to *9* (as is) |
| * */* as `SLASH`, *\* as `BACK_SLASH` |
| * *;* as `SEMI_COLON` |
| * *.* as `PERIOD` |
| * *‘* as `QUOTE` |
| |
| See also link:DevFaqKeybindings.html[DevFaqKeybindings]. |
| |
| (Reposted from link:http://netbeans.dzone.com/tips/play-with-xml-layer[this entry on NetBeans Zone].) |
| |
| === 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/DevFaqTweakRegistryByCodeReplacement[http://wiki.netbeans.org/DevFaqTweakRegistryByCodeReplacement] , |
| that was last modified by NetBeans user Jtulach |
| on 2010-07-24T20:39:23Z. |
| |
| |
| *NOTE:* This document was automatically converted to the AsciiDoc format on 2018-01-10, and needs to be reviewed. |