Changeset 1690 in josm for trunk/src/org/openstreetmap/josm/command
- Timestamp:
- 2009-06-23T22:03:37+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/command
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java
r1654 r1690 66 66 67 67 if (decision.equals(MergeDecisionType.KEEP_MINE)) { 68 // do nothing 68 if (my.deleted) { 69 // because my was involved in a conflict it my still be referred 70 // to from a way or a relation. Fix this now. 71 // 72 Main.main.editLayer().data.unlinkReferencesToPrimitive(my); 73 } 69 74 } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) { 70 my.deleted = their.deleted; 75 if (their.deleted) { 76 Main.main.editLayer().data.unlinkReferencesToPrimitive(my); 77 my.delete(true); 78 } else { 79 my.deleted = their.deleted; 80 } 71 81 } else 72 82 // should not happen -
trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java
r1670 r1690 6 6 import java.util.ArrayList; 7 7 import java.util.Collection; 8 import java.util.HashMap; 8 9 import java.util.List; 10 import java.util.Map; 9 11 10 12 import javax.swing.JLabel; … … 33 35 */ 34 36 public class PurgePrimitivesCommand extends Command{ 37 35 38 36 39 /** … … 141 144 private ArrayList<OsmParentChildPair> pairs; 142 145 146 private Map<OsmPrimitive, OsmPrimitive> resolvedConflicts; 147 143 148 /** 144 149 * constructor … … 149 154 purgedPrimitives = new ArrayList<OsmPrimitive>(); 150 155 pairs = new ArrayList<OsmParentChildPair>(); 156 resolvedConflicts = new HashMap<OsmPrimitive, OsmPrimitive>(); 151 157 } 152 158 … … 180 186 if (pair.getParent() instanceof Way) { 181 187 Way w = (Way)pair.getParent(); 182 System.out.println( "removing reference from way " + w.id);188 System.out.println(tr("removing reference from way {0}",w.id)); 183 189 w.nodes.remove(primitive); 184 190 // if a way ends up with less than two node we … … 194 200 } else if (pair.getParent() instanceof Relation) { 195 201 Relation r = (Relation)pair.getParent(); 196 System.out.println( "removing reference from relation " + r.id);202 System.out.println(tr("removing reference from relation {0}",r.id)); 197 203 r.removeMembersFor(primitive); 198 204 } … … 220 226 } 221 227 purgedPrimitives.add(toPurge); 228 if (Main.map.conflictDialog.conflicts.containsKey(toPurge)) { 229 resolvedConflicts.put(toPurge, Main.map.conflictDialog.conflicts.get(toPurge)); 230 Main.map.conflictDialog.removeConflictForPrimitive(toPurge); 231 } 222 232 } 223 233 return super.executeCommand(); … … 236 246 @Override 237 247 public void undoCommand() { 248 249 // restore purged primitives 250 // 238 251 for (OsmPrimitive purged : purgedPrimitives) { 239 252 Main.ds.addPrimitive(purged); 253 } 254 255 // restore conflicts 256 // 257 for (OsmPrimitive primitive : resolvedConflicts.keySet()) { 258 Main.map.conflictDialog.addConflict(primitive, resolvedConflicts.get(primitive)); 240 259 } 241 260 -
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 } -
trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java
r1670 r1690 11 11 12 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.data.osm.Node;14 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 14 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 16 import org.openstreetmap.josm.data.osm.Relation;17 import org.openstreetmap.josm.data.osm.Way;18 15 import org.openstreetmap.josm.tools.ImageProvider; 19 16
Note: See TracChangeset
for help on using the changeset viewer.