Changeset 2552 in josm for trunk


Ignore:
Timestamp:
2009-11-30T00:02:22+01:00 (15 years ago)
Author:
bastiK
Message:

cleanup for r2539 and r2541. See #3520

File:
1 edited

Legend:

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

    r2541 r2552  
    22package org.openstreetmap.josm.data;
    33
    4 import java.util.ArrayList;
    54import java.util.Collection;
    65import java.util.Iterator;
     
    6766     */
    6867    public void undo() {
    69         Collection<? extends OsmPrimitive> lastSelection = Main.main.getCurrentDataSet().getSelected();
    7068        if (commands.isEmpty())
    7169            return;
     70        Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected();
    7271        final Command c = commands.removeLast();
    7372        c.undoCommand();
     
    7877        }
    7978        fireCommandsChanged();
    80         List<OsmPrimitive> all = Main.main.getCurrentDataSet().allPrimitives();
    81         for (OsmPrimitive op : lastSelection) {
    82             if (all.contains(op)) {
    83                 Main.main.getCurrentDataSet().addSelected(op);
    84             }
     79        Collection<? extends OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected();
     80        if (!oldSelection.equals(newSelection)) {
     81            Main.main.getCurrentDataSet().fireSelectionChanged();
    8582        }
    8683    }
     
    9390        if (redoCommands.isEmpty())
    9491            return;
     92        Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected();
    9593        final Command c = redoCommands.pop();
    9694        c.executeCommand();
     
    10199        }
    102100        fireCommandsChanged();
     101        Collection<? extends OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected();
     102        if (!oldSelection.equals(newSelection)) {
     103            Main.main.getCurrentDataSet().fireSelectionChanged();
     104        }
    103105    }
    104106
Note: See TracChangeset for help on using the changeset viewer.