Ticket #5209: josm_5209.patch
| File josm_5209.patch, 3.0 KB (added by , 15 years ago) |
|---|
-
data/UndoRedoHandler.java
public class UndoRedoHandler implements MapView.La 73 73 if (commands.isEmpty()) 74 74 return; 75 75 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 } 82 85 } 83 86 } 87 finally { 88 Main.main.getCurrentDataSet().endUpdate(); 89 } 84 90 fireCommandsChanged(); 85 91 Collection<? extends OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected(); 86 92 if (!oldSelection.equals(newSelection)) { -
command/ChangePropertyCommand.java
import java.util.List; 12 12 13 13 import javax.swing.JLabel; 14 14 15 import org.openstreetmap.josm.Main; 15 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 17 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 17 18 import org.openstreetmap.josm.gui.DefaultNameFormatter; … … public class ChangePropertyCommand extends Command 72 73 } 73 74 74 75 @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 } 80 89 } 81 } else { 82 for (OsmPrimitive osm : objects) { 83 osm.setModified(true); 84 osm.put(key, value); 85 } 90 return true; 86 91 } 87 return true; 92 finally { 93 Main.main.getCurrentDataSet().endUpdate(); 94 } 88 95 } 89 96 90 97 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
