-
Notifications
You must be signed in to change notification settings - Fork 1
DevFaqRebindingKeys
The simple answer is no: The
global keymap (get Keymap
from Lookup)
is a master keymap for the whole application, and like all keymaps accepts
only one action per binding. If you want multiple actions to be
run, you must create a "wrapper" action that runs them all in turn
(or in parallel).
You may bind a key differently in different windows, by using the normal Swing techniques of binding keystrokes to components. In fact, some work went into implementing the global map so that it would work across arbitrary components; it is overridden by local bindings, such as navigation keys on dialogs or Explorer trees, or various editing keys in the Editor.
Before you bind a key performing a high-level specific action, such as Ctrl-N for New File, to a different action in a local component (e.g. window), think carefully whether this is really the right approach. In many cases the UI of your extension and the IDE as a whole will be better served by leaving the key binding alone, and instead providing an appropriate cookie, action performer, or other callback associated with your component, so that the action (and potentially other code unknown to you) will function naturally. If you must rebind a global key, consider whether it is appropriate to determine the current key binding for the action (if any) in the global keymap, and use this keystroke to rebind - so user customizations will remain intact.
CallbackSystemAction`s such as Find or
Delete can easily have different bindings in each component,
using `ActionMap
.
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/DevFaqRebindingKeys , that was last modified by NetBeans user Admin on 2009-11-06T15:58:58Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.
Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF).
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
This wiki is an experiment pending Apache NetBeans Community approval.