Changeset 13173 in josm for trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java
- Timestamp:
- 2017-11-28T00:56:29+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java
r12620 r13173 36 36 37 37 private final List<KeyPressReleaseListener> keyListeners = new CopyOnWriteArrayList<>(); 38 /** @deprecated replaced by {@link #modifierExListeners} */39 @Deprecated40 private final List<ModifierListener> modifierListeners = new CopyOnWriteArrayList<>();41 38 private final ListenerList<ModifierExListener> modifierExListeners = ListenerList.create(); 42 /** @deprecated replaced by {@link #previousModifiersEx} */43 @Deprecated44 private int previousModifiers;45 39 private int previousModifiersEx; 46 40 … … 53 47 public void addKeyListener(KeyPressReleaseListener l) { 54 48 keyListeners.add(l); 55 }56 57 /**58 * Adds an object that wants to receive key modifier changed events.59 * @param l listener to add60 * @deprecated use {@link #addModifierExListener} instead61 */62 @Deprecated63 public void addModifierListener(ModifierListener l) {64 modifierListeners.add(l);65 49 } 66 50 … … 80 64 public void removeKeyListener(KeyPressReleaseListener l) { 81 65 keyListeners.remove(l); 82 }83 84 /**85 * Removes the key modifier listener.86 * @param l listener to remove87 * @deprecated use {@link #removeModifierExListener} instead88 */89 @Deprecated90 public void removeModifierListener(ModifierListener l) {91 modifierListeners.remove(l);92 66 } 93 67 … … 131 105 if (!keyListeners.isEmpty()) { 132 106 Logging.warn(tr("Some of the key listeners forgot to remove themselves: {0}"), keyListeners.toString()); 133 }134 if (!modifierListeners.isEmpty()) {135 Logging.warn(tr("Some of the key modifier listeners forgot to remove themselves: {0}"), modifierListeners.toString());136 107 } 137 108 if (modifierExListeners.hasListeners()) { … … 183 154 KeyEvent ke = (KeyEvent) e; 184 155 185 // check if ctrl, alt, shift modifiers are changed186 int modif = ke.getModifiers();187 if (previousModifiers != modif) {188 previousModifiers = modif;189 for (ModifierListener m: modifierListeners) {190 m.modifiersChanged(modif);191 }192 }193 194 156 // check if ctrl, alt, shift extended modifiers are changed 195 157 int modifEx = ke.getModifiersEx();
Note:
See TracChangeset
for help on using the changeset viewer.