Changeset 12970 in josm


Ignore:
Timestamp:
2017-10-09T21:57:25+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15008, see #15421 - add toString() methods to allow to report potentially incorrect selection events

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DataSelectionListener.java

    r12329 r12970  
    158158            }
    159159            return added;
     160        }
     161
     162        @Override
     163        public String toString() {
     164            return "SelectionReplaceEvent [current=" + current + ", removed=" + removed + ", added=" + added + ']';
    160165        }
    161166    }
     
    202207        public Set<OsmPrimitive> getAdded() {
    203208            return Collections.unmodifiableSet(add);
     209        }
     210
     211        @Override
     212        public String toString() {
     213            return "SelectionAddEvent [add=" + add + ", current=" + current + ']';
    204214        }
    205215    }
     
    247257        public Set<OsmPrimitive> getAdded() {
    248258            return Collections.emptySet();
     259        }
     260
     261        @Override
     262        public String toString() {
     263            return "SelectionRemoveEvent [remove=" + remove + ", current=" + current + ']';
    249264        }
    250265    }
     
    298313            return Collections.unmodifiableSet(add);
    299314        }
     315
     316        @Override
     317        public String toString() {
     318            return "SelectionToggleEvent [current=" + current + ", remove=" + remove + ", add=" + add + ']';
     319        }
    300320    }
    301321}
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r12873 r12970  
    207207        // the listener, projection change listeners are managed as WeakReferences.
    208208        Main.addProjectionChangeListener(this);
    209         addSelectionListener((DataSelectionListener) e -> fireDreprecatedSelectionChange(e.getSelection()));
     209        addSelectionListener((DataSelectionListener) e -> fireDeprecatedSelectionChange(e.getSelection()));
    210210    }
    211211
     
    682682    @Deprecated
    683683    public void fireSelectionChanged() {
    684         fireDreprecatedSelectionChange(getAllSelected());
    685     }
    686 
    687     private static void fireDreprecatedSelectionChange(Collection<? extends OsmPrimitive> currentSelection) {
     684        fireDeprecatedSelectionChange(getAllSelected());
     685    }
     686
     687    private static void fireDeprecatedSelectionChange(Collection<? extends OsmPrimitive> currentSelection) {
    688688        for (SelectionChangedListener l : selListeners) {
    689689            l.selectionChanged(currentSelection);
  • trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java

    r12636 r12970  
    178178            // If we would not do this, e.g. the move command would have a hard time tracking which layer
    179179            // the last moved selection was in.
    180             SelectionReplaceEvent event = new SelectionReplaceEvent(oldDataSet,
    181                     new HashSet<>(oldDataSet.getAllSelected()), Stream.empty());
    182             selectionChanged(event);
     180            selectionChanged(new SelectionReplaceEvent(oldDataSet,
     181                    new HashSet<>(oldDataSet.getAllSelected()), Stream.empty()));
    183182            oldDataSet.removeSelectionListener(this);
    184183        }
     
    187186            newDataSet.addSelectionListener(this);
    188187            // Fake a selection add
    189             SelectionReplaceEvent event = new SelectionReplaceEvent(newDataSet,
    190                     Collections.emptySet(), newDataSet.getAllSelected().stream());
    191             selectionChanged(event);
     188            selectionChanged(new SelectionReplaceEvent(newDataSet,
     189                    Collections.emptySet(), newDataSet.getAllSelected().stream()));
    192190        }
    193191    }
Note: See TracChangeset for help on using the changeset viewer.