Changeset 2655 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2009-12-19T10:47:49+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r2645 r2655 26 26 import java.util.Map.Entry; 27 27 import java.util.concurrent.CopyOnWriteArrayList; 28 import java.util.logging.Logger;29 28 import java.util.regex.Matcher; 30 29 import java.util.regex.Pattern; … … 44 43 */ 45 44 public class Preferences { 46 static private final Logger logger = Logger.getLogger(Preferences.class.getName());45 //static private final Logger logger = Logger.getLogger(Preferences.class.getName()); 47 46 48 47 /** … … 131 130 132 131 public void addPreferenceChangeListener(PreferenceChangedListener listener) { 133 if (listener != null && ! listeners.contains(listener)) {134 listeners.add (listener);132 if (listener != null) { 133 listeners.addIfAbsent(listener); 135 134 } 136 135 } 137 136 138 137 public void removePreferenceChangeListener(PreferenceChangedListener listener) { 139 if (listener != null && listeners.contains(listener)) { 140 listeners.remove(listener); 141 } 138 listeners.remove(listener); 142 139 } 143 140 -
trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
r2512 r2655 42 42 43 43 public void addConflictListener(IConflictListener listener) { 44 if (listener != null && ! listeners.contains(listener)) {45 listeners.add (listener);44 if (listener != null) { 45 listeners.addIfAbsent(listener); 46 46 } 47 47 } 48 48 49 49 public void removeConflictListener(IConflictListener listener) { 50 if (listener != null) { 51 listeners.remove(listener); 52 } 50 listeners.remove(listener); 53 51 } 54 52 -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r2618 r2655 8 8 import java.util.Map; 9 9 import java.util.concurrent.CopyOnWriteArrayList; 10 import java.util.logging.Logger;11 10 12 11 import org.openstreetmap.josm.Main; … … 15 14 16 15 public class ChangesetCache implements PreferenceChangedListener{ 17 static private final Logger logger = Logger.getLogger(ChangesetCache.class.getName());16 //static private final Logger logger = Logger.getLogger(ChangesetCache.class.getName()); 18 17 static private final ChangesetCache instance = new ChangesetCache(); 19 18 … … 32 31 33 32 public void addChangesetCacheListener(ChangesetCacheListener listener) { 34 synchronized(listeners) { 35 if (listener != null && ! listeners.contains(listener)) { 36 listeners.add(listener); 37 } 33 if (listener != null) { 34 listeners.addIfAbsent(listener); 38 35 } 39 36 } 40 37 41 38 public void removeChangesetCacheListener(ChangesetCacheListener listener) { 42 synchronized(listeners) { 43 if (listener != null && listeners.contains(listener)) { 44 listeners.remove(listener); 45 } 46 } 39 listeners.remove(listener); 47 40 } 48 41 -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2623 r2655 21 21 import org.openstreetmap.josm.data.SelectionChangedListener; 22 22 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; 23 import org.openstreetmap.josm.data.osm.event.ChangesetIdChangedEvent; 23 24 import org.openstreetmap.josm.data.osm.event.DataChangedEvent; 24 25 import org.openstreetmap.josm.data.osm.event.DataSetListener; … … 863 864 } 864 865 866 void fireChangesetIdChanged(OsmPrimitive primitive, int oldChangesetId, int newChangesetId) { 867 fireEvent(new ChangesetIdChangedEvent(this, Collections.singletonList(primitive), oldChangesetId, newChangesetId)); 868 } 869 865 870 public void clenupDeletedPrimitives() { 866 871 if (cleanupDeleted(nodes.iterator()) -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2651 r2655 649 649 */ 650 650 public void setChangesetId(int changesetId) throws IllegalStateException, IllegalArgumentException { 651 if (this.changesetId == changesetId) 652 return; 651 653 if (changesetId < 0) 652 654 throw new IllegalArgumentException(tr("Parameter ''{0}'' >= 0 expected, got {1}", "changesetId", changesetId)); 653 655 if (isNew() && changesetId > 0) 654 656 throw new IllegalStateException(tr("Can''t assign a changesetId > 0 to a new primitive. Value of changesetId is {0}", changesetId)); 657 int old = this.changesetId; 655 658 this.changesetId = changesetId; 659 if (dataSet != null) { 660 dataSet.fireChangesetIdChanged(this, old, changesetId); 661 } 656 662 } 657 663 … … 1003 1009 flags = other.flags; 1004 1010 user= other.user; 1005 changesetId = other.changesetId;1011 setChangesetId(other.changesetId); 1006 1012 clearCached(); 1007 1013 } … … 1031 1037 flags = other.flags; 1032 1038 user= other.user; 1033 changesetId = other.changesetId;1039 setChangesetId(other.changesetId); 1034 1040 } 1035 1041 … … 1178 1184 timestamp = data.getTimestamp(); 1179 1185 user = data.getUser(); 1180 changesetId = data.getChangesetId();1186 setChangesetId(data.getChangesetId()); 1181 1187 setDeleted(data.isDeleted()); 1182 1188 setModified(data.isModified()); -
trunk/src/org/openstreetmap/josm/data/osm/event/AbstractDatasetChangedEvent.java
r2645 r2655 11 11 12 12 public enum DatasetEventType {DATA_CHANGED, NODE_MOVED, PRIMITIVES_ADDED, PRIMITIVES_REMOVED, 13 RELATION_MEMBERS_CHANGED, TAGS_CHANGED, WAY_NODES_CHANGED }13 RELATION_MEMBERS_CHANGED, TAGS_CHANGED, WAY_NODES_CHANGED, CHANGESET_ID_CHANGED} 14 14 15 15 protected final DataSet dataSet; -
trunk/src/org/openstreetmap/josm/data/osm/event/DataSetListener.java
r2622 r2655 73 73 74 74 /** 75 * Minor dataset change, currently only changeset id changed is supported, but can 76 * be extended in future. 77 * @param event 78 */ 79 void otherDatasetChange(AbstractDatasetChangedEvent event); 80 81 /** 75 82 * Called after big changes in dataset. Usually other events are stopped using Dataset.beginUpdate() and 76 83 * after operation is completed (Dataset.endUpdate()), {@link #dataChanged()} is called. 77 84 */ 78 85 void dataChanged(DataChangedEvent event); 79 80 86 } -
trunk/src/org/openstreetmap/josm/data/osm/event/DataSetListenerAdapter.java
r2645 r2655 48 48 } 49 49 50 public void otherDatasetChange(AbstractDatasetChangedEvent event) { 51 listener.processDatasetEvent(event); 52 } 53 50 54 } -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
r2512 r2655 7 7 import java.util.HashMap; 8 8 import java.util.concurrent.CopyOnWriteArrayList; 9 import java.util.logging.Logger;10 9 11 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 19 18 */ 20 19 public class HistoryDataSet { 21 private final static Logger logger = Logger.getLogger(HistoryDataSet.class.getName());20 //private final static Logger logger = Logger.getLogger(HistoryDataSet.class.getName()); 22 21 23 22 /** the unique instance */ … … 46 45 47 46 public void addHistoryDataSetListener(HistoryDataSetListener listener) { 48 synchronized(listeners) { 49 if (!listeners.contains(listener)) { 50 listeners.add(listener); 51 } 47 if (listener != null) { 48 listeners.addIfAbsent(listener); 52 49 } 53 50 } 54 51 55 52 public void removeHistoryDataSetListener(HistoryDataSetListener listener) { 56 synchronized(listeners) { 57 if (listeners.contains(listener)) { 58 listeners.remove(listener); 59 } 60 } 53 listeners.remove(listener); 61 54 } 62 55
Note:
See TracChangeset
for help on using the changeset viewer.