Changeset 5993 in josm for trunk/src


Ignore:
Timestamp:
2013-06-06T20:53:11+02:00 (11 years ago)
Author:
Don-vip
Message:

see #6529, comment 12: purge conflicts when purging primitives (with undo support to restore them if needed)

File:
1 edited

Legend:

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

    r5905 r5993  
    1515import javax.swing.Icon;
    1616
     17import org.openstreetmap.josm.data.conflict.Conflict;
     18import org.openstreetmap.josm.data.conflict.ConflictCollection;
    1719import org.openstreetmap.josm.data.osm.DataSet;
    1820import org.openstreetmap.josm.data.osm.Node;
     
    3739
    3840    protected Map<PrimitiveId, PrimitiveData> makeIncompleteData_byPrimId;
     41   
     42    protected final ConflictCollection purgedConflicts = new ConflictCollection();
    3943
    4044    final protected DataSet ds;
     
    7680        ds.beginUpdate();
    7781        try {
     82            purgedConflicts.get().clear();
    7883            /**
    7984             * Loop from back to front to keep referential integrity.
     
    97102                } else {
    98103                    ds.removePrimitive(osm);
     104                    Conflict<?> conflict = getLayer().getConflicts().getConflictForMy(osm);
     105                    if (conflict != null) {
     106                        purgedConflicts.add(conflict);
     107                        getLayer().getConflicts().remove(conflict);
     108                    }
    99109                }
    100110            }
     
    121131                ds.addPrimitive(osm);
    122132            }
     133        }
     134       
     135        for (Conflict<?> conflict : purgedConflicts) {
     136            getLayer().getConflicts().add(conflict);
    123137        }
    124138    }
Note: See TracChangeset for help on using the changeset viewer.