Ticket #17401: 17401-v2.patch
File 17401-v2.patch, 3.3 KB (added by , 5 years ago) |
---|
-
src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
34 34 import org.openstreetmap.josm.actions.ValidateAction; 35 35 import org.openstreetmap.josm.actions.relation.EditRelationAction; 36 36 import org.openstreetmap.josm.command.Command; 37 import org.openstreetmap.josm.command.SequenceCommand; 37 38 import org.openstreetmap.josm.data.UndoRedoHandler; 38 39 import org.openstreetmap.josm.data.osm.DataSelectionListener; 39 40 import org.openstreetmap.josm.data.osm.DataSet; … … 601 602 // do nothing 602 603 } 603 604 604 protected void fixError(TestError error) throws InterruptedException, InvocationTargetException{605 protected void fixError(TestError error) { 605 606 if (error.isFixable()) { 606 607 final Command fixCommand = error.getFix(); 607 608 if (fixCommand != null) { 608 SwingUtilities.invokeAndWait(() -> UndoRedoHandler.getInstance().addNoRedraw(fixCommand));609 609 fixCommands.add(fixCommand); 610 610 } 611 611 // It is wanted to ignore an error if it said fixable, even if fixCommand was null … … 636 636 SwingUtilities.invokeAndWait(ds::endUpdate); 637 637 } 638 638 monitor.subTask(tr("Updating map ...")); 639 List<TestError> oldErrors = new ArrayList<>(tree.getErrors()); 640 tree.getErrors().clear(); 639 641 SwingUtilities.invokeAndWait(() -> { 640 UndoRedoHandler.getInstance().a fterAdd(fixCommands);642 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("fixed by Validator"), fixCommands, true)); 641 643 invalidateValidatorLayers(); 642 tree.resetErrors();643 644 }); 645 646 oldErrors.removeIf(error -> error.getPrimitives().stream().anyMatch(OsmPrimitive::isDeleted)); 647 tree.getErrors().addAll(oldErrors); 648 tree.resetErrors(); 644 649 } catch (InterruptedException | InvocationTargetException e) { 645 650 // FIXME: signature of realRun should have a generic checked exception we could throw here 646 651 throw new JosmRuntimeException(e); -
src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
483 483 484 484 @Override public void primitivesRemoved(PrimitivesRemovedEvent event) { 485 485 // Remove purged primitives (fix #8639) 486 if (errors != null) { 487 final Set<? extends OsmPrimitive> deletedPrimitives = new HashSet<>(event.getPrimitives()); 488 errors.removeIf(error -> error.getPrimitives().stream().anyMatch(deletedPrimitives::contains)); 486 if (errors != null && !errors.isEmpty()) { 487 errors.removeIf(error -> error.getPrimitives().stream().anyMatch(OsmPrimitive::isDeleted)); 489 488 } 490 489 } 491 490