MCPcopy
hub / github.com/arduino/Arduino / killBinding

Method killBinding

app/src/processing/app/helpers/Keys.java:135–144  ·  view source on GitHub ↗

Kill an existing binding from the given condition. If the binding is defined on the given component, it is removed, but if it is defined through a parent inputmap (typically shared by multiple components, so best not touched), this adds a dummy binding for this component, that will never match an ac

(final JComponent component,
                                 final KeyStroke keystroke, int condition)

Source from the content-addressed store, hash-verified

133 * such a binding would get re-enabled when the action is re-enabled.
134 */
135 public static void killBinding(final JComponent component,
136 final KeyStroke keystroke, int condition) {
137 InputMap map = component.getInputMap(condition);
138 // First, try removing it
139 map.remove(keystroke);
140 // If the binding is defined in a parent map, defining it will not work, so
141 // instead add an override that will never appear in the action map.
142 if (map.get(keystroke) != null)
143 map.put(keystroke, new Object());
144 }
145
146 /**
147 * Kill an existing binding like above, but from all three conditions

Callers 1

EditorMethod · 0.95

Calls 3

putMethod · 0.80
getMethod · 0.65
removeMethod · 0.45

Tested by

no test coverage detected