Changeset 1690 in josm for trunk/src/org/openstreetmap/josm/command/UndeletePrimitivesCommand.java
- Timestamp:
- 23.06.2009 22:03:37 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/UndeletePrimitivesCommand.java
r1670 r1690 6 6 import java.util.ArrayList; 7 7 import java.util.Collection; 8 import java.util.HashMap; 9 import java.util.Map; 8 10 9 11 import javax.swing.JLabel; … … 11 13 import javax.swing.tree.MutableTreeNode; 12 14 15 import org.openstreetmap.josm.Main; 13 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 17 import org.openstreetmap.josm.tools.ImageProvider; … … 24 27 /** the node to undelete */ 25 28 private ArrayList<OsmPrimitive> toUndelete; 29 private Map<OsmPrimitive,OsmPrimitive> resolvedConflicts; 26 30 31 protected UndeletePrimitivesCommand() { 32 toUndelete = new ArrayList<OsmPrimitive>(); 33 resolvedConflicts = new HashMap<OsmPrimitive, OsmPrimitive>(); 34 } 27 35 /** 28 36 * constructor … … 30 38 */ 31 39 public UndeletePrimitivesCommand(OsmPrimitive node) { 32 t oUndelete = new ArrayList<OsmPrimitive>();40 this(); 33 41 toUndelete.add(node); 34 42 } … … 39 47 */ 40 48 public UndeletePrimitivesCommand(OsmPrimitive ... toUndelete) { 41 this .toUndelete = new ArrayList<OsmPrimitive>();49 this(); 42 50 for (int i=0; i < toUndelete.length; i++) { 43 51 this.toUndelete.add(toUndelete[i]); … … 50 58 */ 51 59 public UndeletePrimitivesCommand(Collection<OsmPrimitive> toUndelete) { 52 this .toUndelete = new ArrayList<OsmPrimitive>();60 this(); 53 61 this.toUndelete.addAll(toUndelete); 54 62 } … … 70 78 super.executeCommand(); 71 79 for(OsmPrimitive primitive: toUndelete) { 80 if (Main.map.conflictDialog.conflicts.containsKey(primitive)) { 81 resolvedConflicts.put(primitive, Main.map.conflictDialog.conflicts.get(primitive)); 82 Main.map.conflictDialog.removeConflictForPrimitive(primitive); 83 } 72 84 primitive.id = 0; 73 85 } … … 80 92 modified.addAll(toUndelete); 81 93 } 94 @Override 95 public void undoCommand() { 96 super.undoCommand(); 97 98 for (OsmPrimitive my: resolvedConflicts.keySet()) { 99 if (!Main.map.conflictDialog.conflicts.containsKey(my)) { 100 Main.map.conflictDialog.addConflict(my, resolvedConflicts.get(my)); 101 } 102 } 103 } 82 104 }
Note: See TracChangeset
for help on using the changeset viewer.
