- Timestamp:
- 2013-04-29T01:29:55+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r5783 r5911 8 8 import java.util.TreeSet; 9 9 10 import org.openstreetmap.josm.Main; 10 11 import org.openstreetmap.josm.command.Command; 11 12 import org.openstreetmap.josm.data.osm.Node; … … 14 15 import org.openstreetmap.josm.data.osm.Way; 15 16 import org.openstreetmap.josm.data.osm.WaySegment; 17 import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; 18 import org.openstreetmap.josm.data.osm.event.DataChangedEvent; 19 import org.openstreetmap.josm.data.osm.event.DataSetListener; 20 import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; 21 import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent; 22 import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; 23 import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; 24 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 25 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 16 26 import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor; 17 27 … … 20 30 * @author frsantos 21 31 */ 22 public class TestError implements Comparable<TestError> {32 public class TestError implements Comparable<TestError>, DataSetListener { 23 33 /** is this error on the ignore list */ 24 34 private Boolean ignored = false; … … 290 300 return v1.toString().compareToIgnoreCase(v2.toString()); 291 301 } 302 303 @Override public void primitivesRemoved(PrimitivesRemovedEvent event) { 304 // Remove purged primitives (fix #8639) 305 try { 306 primitives.removeAll(event.getPrimitives()); 307 } catch (UnsupportedOperationException e) { 308 if (event.getPrimitives().containsAll(primitives)) { 309 primitives = Collections.emptyList(); 310 } else { 311 Main.warn("Unable to remove primitives from "+this); 312 } 313 } 314 } 315 316 @Override public void primitivesAdded(PrimitivesAddedEvent event) {} 317 @Override public void tagsChanged(TagsChangedEvent event) {} 318 @Override public void nodeMoved(NodeMovedEvent event) {} 319 @Override public void wayNodesChanged(WayNodesChangedEvent event) {} 320 @Override public void relationMembersChanged(RelationMembersChangedEvent event) {} 321 @Override public void otherDatasetChange(AbstractDatasetChangedEvent event) {} 322 @Override public void dataChanged(DataChangedEvent event) {} 323 324 @Override 325 public String toString() { 326 return "TestError [tester=" + tester + ", code=" + code + "]"; 327 } 292 328 } -
trunk/src/org/openstreetmap/josm/data/validation/util/MultipleNameVisitor.java
r5353 r5911 60 60 } 61 61 62 if (size == 1) {62 if (size <= 1) { 63 63 displayName = name; 64 64 } else { … … 92 92 */ 93 93 public Icon getIcon() { 94 if (size == 1)94 if (size <= 1) 95 95 return icon; 96 96 else -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r5891 r5911 22 22 23 23 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.data.osm.DataSet; 24 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; 25 26 import org.openstreetmap.josm.data.validation.Severity; … … 27 28 import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor; 28 29 import org.openstreetmap.josm.gui.preferences.ValidatorPreference; 30 import org.openstreetmap.josm.tools.Destroyable; 29 31 import org.openstreetmap.josm.tools.MultiMap; 30 32 … … 36 38 * @author frsantos 37 39 */ 38 public class ValidatorTreePanel extends JTree {40 public class ValidatorTreePanel extends JTree implements Destroyable { 39 41 /** Serializable ID */ 40 42 private static final long serialVersionUID = 2952292777351992696L; … … 294 296 if (errors == null) 295 297 return; 296 errors.clear(); 298 clearErrors(); 299 DataSet ds = Main.main.getCurrentDataSet(); 297 300 for (TestError error : newerrors) { 298 301 if (!error.getIgnored()) { 299 302 errors.add(error); 303 if (ds != null) { 304 ds.addDataSetListener(error); 305 } 300 306 } 301 307 } … … 374 380 return updateCount; 375 381 } 382 383 private void clearErrors() { 384 if (errors != null) { 385 DataSet ds = Main.main.getCurrentDataSet(); 386 if (ds != null) { 387 for (TestError e : errors) { 388 ds.removeDataSetListener(e); 389 } 390 } 391 errors.clear(); 392 } 393 } 394 395 @Override 396 public void destroy() { 397 clearErrors(); 398 } 376 399 }
Note:
See TracChangeset
for help on using the changeset viewer.