| // |
| // 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. |
| // |
| |
| = DevFaqKeybindings |
| :jbake-type: wiki |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| :keywords: Apache NetBeans wiki DevFaqKeybindings |
| :description: Apache NetBeans wiki DevFaqKeybindings |
| :toc: left |
| :toc-title: |
| :syntax: true |
| |
| === How do keybindings work? |
| |
| Keybindings are specified in yet another folder in the link:DevFaqSystemFilesystem.asciidoc[system filesystem ]. The folder Shortcuts/ contains link:DevFaqInstanceDataObject.asciidoc[.instance files] or link:DevFaqDotShadowFiles.asciidoc[.shadow files] (shadow files are like symlinks to another file in the system fs) - these map to Actions. |
| |
| The file name for the action (`.instance` or `.shadow`) file in `Shortcuts/` is used to specify what keys are bound. This is done using an link:http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/Utilities.html#stringToKey(java.lang.String)[emacs-like syntax for specifying keybindings] - e.g., `CA-P` equals Ctrl-Alt-P. |
| |
| For a full listing of the hard-coded and cross-platform prefixes for key definitions, see link:http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/Utilities.html#stringToKey(java.lang.String)[the javadoc for Utilities.stringToKey()] - that and its analogue, `Utilities.keyToString()` are used to encode and decode these. |
| |
| There are special modifier characters which link:DevFaqLogicalKeybindings.asciidoc[map to Command on Mac and Ctrl on PC, Ctrl on Mac and Alt on PC]. You should use those unless you're _really sure_ your app will never be used on macintosh or never be used by someone with a non-English macintosh. |
| |
| Here is an example of what a layer file might look like if you bound the Ctrl+Shift+Equals sequence to the `com.tomwheeler.example.fooviewer.FooAction` action: |
| |
| [source,xml] |
| ---- |
| |
| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.0//EN" |
| "http://www.netbeans.org/dtds/filesystem-1_0.dtd"> |
| |
| <filesystem> |
| <folder name="Actions"> |
| <folder name="View"> |
| <folder name="FooViewer"> |
| <file name="com-tomwheeler-example-fooviewer-FooAction.instance" /> |
| </folder> |
| </folder> |
| </folder> |
| |
| <folder name="Shortcuts"> |
| <!-- |
| set up a shortcut key for executing the Foo Action: |
| Ctrl + Shift + Equals on Linux and MS Windows, but Command + Shift + Equals on a Mac |
| --> |
| <file name="DS-EQUALS.shadow"> |
| <attr name="originalFile" stringvalue="Actions/View/FooViewer/com-tomwheeler-example-fooviewer-FooAction.instance"/> |
| </file> |
| </folder> |
| </filesystem> |
| |
| ---- |
| |
| === 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/DevFaqKeybindings[http://wiki.netbeans.org/DevFaqKeybindings] , |
| that was last modified by NetBeans user Jtulach |
| on 2010-07-24T20:22:15Z. |
| |
| |
| *NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed. |