Changeset 17252 in josm
- Timestamp:
- 2020-10-22T12:08:47+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r16553 r17252 11 11 import java.util.List; 12 12 import java.util.Locale; 13 import java.util.Set; 13 14 import java.util.TreeSet; 14 15 import java.util.function.Supplier; … … 24 25 import org.openstreetmap.josm.data.osm.Way; 25 26 import org.openstreetmap.josm.data.osm.WaySegment; 27 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker; 26 28 import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor; 29 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 27 30 import org.openstreetmap.josm.tools.AlphanumComparator; 28 31 import org.openstreetmap.josm.tools.CheckParameterUtil; 29 32 import org.openstreetmap.josm.tools.I18n; 33 import org.openstreetmap.josm.tools.Logging; 30 34 31 35 /** … … 545 549 } 546 550 551 /** 552 * Test if the primitives still show the same error. Maybe data was already changed. See #19956 553 * @return updated test or null if error cannot be reproduced. 554 * @since 17252 555 */ 556 public TestError doubleCheck() { 557 // see #19956 check again 558 if (getTester() instanceof MapCSSTagChecker) 559 return this; 560 Test tester2; 561 try { 562 tester2 = getTester().getClass().newInstance(); 563 Set<OsmPrimitive> toFix = primitives.stream() 564 .filter(tester2::isPrimitiveUsable) 565 .collect(Collectors.toSet()); 566 if (toFix.isEmpty()) 567 return null; 568 569 tester2.startTest(NullProgressMonitor.INSTANCE); 570 tester2.visit(toFix); 571 tester2.endTest(); 572 for (TestError e : tester2.getErrors()) { 573 if (e.getCode() == this.getCode()) { 574 return e; 575 } 576 } 577 } catch (InstantiationException | IllegalAccessException e1) { 578 Logging.error(e1); 579 } 580 return null; 581 582 } 583 547 584 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r17188 r17252 628 628 if (error.isFixable()) { 629 629 if (error.getPrimitives().stream().noneMatch(p -> p.isDeleted() || p.getDataSet() == null)) { 630 final Command fixCommand = error.getFix(); 631 if (fixCommand != null) { 632 SwingUtilities.invokeAndWait(fixCommand::executeCommand); 633 fixCommands.add(fixCommand); 630 TestError checked = error.doubleCheck(); 631 if (checked != null) { 632 final Command fixCommand = checked.getFix(); 633 if (fixCommand != null) { 634 SwingUtilities.invokeAndWait(fixCommand::executeCommand); 635 fixCommands.add(fixCommand); 636 } 634 637 } 635 638 }
Note:
See TracChangeset
for help on using the changeset viewer.