Changeset 12518 in josm


Ignore:
Timestamp:
2017-07-26T23:31:41+02:00 (2 years ago)
Author:
Don-vip
Message:

see #11924 - use ListenerList, fix javadoc

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

    r12517 r12518  
    173173     * Update internal ctrl, alt, shift mask from given extended modifiers mask.
    174174     * @param modifiers event extended modifiers mask
    175      * @since 12516
     175     * @since 12517
    176176     */
    177177    protected void updateKeyModifiersEx(int modifiers) {
  • trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java

    r12517 r12518  
    2020
    2121import org.openstreetmap.josm.Main;
     22import org.openstreetmap.josm.tools.ListenerList;
    2223
    2324/**
     
    3738    @Deprecated
    3839    private final List<ModifierListener> modifierListeners = new CopyOnWriteArrayList<>();
    39     private final List<ModifierExListener> modifierExListeners = new CopyOnWriteArrayList<>();
     40    private final ListenerList<ModifierExListener> modifierExListeners = ListenerList.create();
     41    @Deprecated
    4042    private int previousModifiers;
    4143    private int previousModifiersEx;
     
    6466     * Adds an object that wants to receive extended key modifier changed events.
    6567     * @param l listener to add
    66      * @since 12516
     68     * @since 12517
    6769     */
    6870    public void addModifierExListener(ModifierExListener l) {
    69         modifierExListeners.add(l);
     71        modifierExListeners.addListener(l);
    7072    }
    7173
     
    9193     * Removes the extended key modifier listener.
    9294     * @param l listener to remove
    93      * @since 12516
     95     * @since 12517
    9496     */
    9597    public void removeModifierExListener(ModifierExListener l) {
    96         modifierExListeners.remove(l);
     98        modifierExListeners.removeListener(l);
    9799    }
    98100
     
    131133            Main.warn(tr("Some of the key modifier listeners forgot to remove themselves: {0}"), modifierListeners.toString());
    132134        }
    133         if (!modifierExListeners.isEmpty()) {
     135        if (modifierExListeners.hasListeners()) {
    134136            Main.warn(tr("Some of the key modifier listeners forgot to remove themselves: {0}"), modifierExListeners.toString());
    135137        }
     
    195197        if (previousModifiersEx != modifEx) {
    196198            previousModifiersEx = modifEx;
    197             for (ModifierExListener m: modifierExListeners) {
    198                 m.modifiersExChanged(modifEx);
    199             }
     199            modifierExListeners.fireEvent(m -> m.modifiersExChanged(modifEx));
    200200        }
    201201
  • trunk/src/org/openstreetmap/josm/gui/util/ModifierExListener.java

    r12517 r12518  
    44/**
    55 * Listener called when pressed extended modifier keys change is detected.
    6  * @since 12516
     6 * @since 12517
    77 */
    88@FunctionalInterface
Note: See TracChangeset for help on using the changeset viewer.