Changeset 3910 in josm


Ignore:
Timestamp:
Feb 18, 2011 9:49:28 AM (2 years ago)
Author:
stoecker
Message:

apply #5209 - reduce repeated signaling

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r3262 r3910  
    1313import javax.swing.JLabel; 
    1414 
     15import org.openstreetmap.josm.Main; 
    1516import org.openstreetmap.josm.data.osm.OsmPrimitive; 
    1617import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 
     
    7374 
    7475    @Override public boolean executeCommand() { 
    75         super.executeCommand(); // save old 
    76         if (value == null) { 
    77             for (OsmPrimitive osm : objects) { 
    78                 osm.setModified(true); 
    79                 osm.remove(key); 
     76        Main.main.getCurrentDataSet().beginUpdate(); 
     77        try { 
     78            super.executeCommand(); // save old 
     79            if (value == null) { 
     80                for (OsmPrimitive osm : objects) { 
     81                    osm.setModified(true); 
     82                    osm.remove(key); 
     83                } 
     84            } else { 
     85                for (OsmPrimitive osm : objects) { 
     86                    osm.setModified(true); 
     87                    osm.put(key, value); 
     88                } 
    8089            } 
    81         } else { 
    82             for (OsmPrimitive osm : objects) { 
    83                 osm.setModified(true); 
    84                 osm.put(key, value); 
    85             } 
     90            return true; 
    8691        } 
    87         return true; 
     92        finally { 
     93            Main.main.getCurrentDataSet().endUpdate(); 
     94        } 
    8895    } 
    8996 
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r3479 r3910  
    7474            return; 
    7575        Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected(); 
    76         for (int i=1; i<=num; ++i) { 
    77             final Command c = commands.removeLast(); 
    78             c.undoCommand(); 
    79             redoCommands.addFirst(c); 
    80             if (commands.isEmpty()) { 
    81                 break; 
     76        Main.main.getCurrentDataSet().beginUpdate(); 
     77        try { 
     78            for (int i=1; i<=num; ++i) { 
     79                final Command c = commands.removeLast(); 
     80                c.undoCommand(); 
     81                redoCommands.addFirst(c); 
     82                if (commands.isEmpty()) { 
     83                    break; 
     84                } 
    8285            } 
     86        } 
     87        finally { 
     88            Main.main.getCurrentDataSet().endUpdate(); 
    8389        } 
    8490        fireCommandsChanged(); 
Note: See TracChangeset for help on using the changeset viewer.