Changeset 14849 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-03-06T16:38:08+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r14847 r14849 63 63 import org.openstreetmap.josm.gui.preferences.validator.ValidatorPreference; 64 64 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 65 import org.openstreetmap.josm.gui.util.GuiHelper; 65 66 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 66 67 import org.openstreetmap.josm.io.OsmTransferException; … … 610 611 protected void fixError(TestError error) throws InterruptedException, InvocationTargetException { 611 612 if (error.isFixable()) { 612 if (error.getPrimitives().stream().noneMatch( OsmPrimitive::isDeleted)) {613 if (error.getPrimitives().stream().noneMatch(p -> p.isDeleted() || p.getDataSet() == null)) { 613 614 final Command fixCommand = error.getFix(); 614 615 if (fixCommand != null) { … … 632 633 int i = 0; 633 634 SwingUtilities.invokeAndWait(ds::beginUpdate); 635 tree.setResetScheduled(); 634 636 try { 635 637 for (TestError error: testErrors) { … … 651 653 } 652 654 invalidateValidatorLayers(); 653 tree.resetErrors();654 655 }); 655 656 } catch (InterruptedException e) { … … 663 664 tryUndo(); 664 665 } 666 GuiHelper.runInEDTAndWait(tree::resetErrors); 665 667 monitor.finishTask(); 666 668 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r14839 r14849 81 81 private transient Set<? extends OsmPrimitive> filter; 82 82 83 private final ListenerList<Runnable> invalidationListeners = ListenerList.create(); 83 private final transient ListenerList<Runnable> invalidationListeners = ListenerList.create(); 84 85 /** if true, buildTree() does nothing */ 86 private boolean resetScheduled; 84 87 85 88 /** … … 148 151 */ 149 152 public void buildTree() { 153 if (resetScheduled) 154 return; 150 155 final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(); 151 156 … … 402 407 */ 403 408 public void resetErrors() { 409 resetScheduled = false; 410 filterRemovedPrimitives(); 404 411 setErrors(new ArrayList<>(errors)); 405 412 } … … 481 488 @Override public void primitivesRemoved(PrimitivesRemovedEvent event) { 482 489 // Remove purged primitives (fix #8639) 483 if (errors != null) { 484 final Set<? extends OsmPrimitive> deletedPrimitives = new HashSet<>(event.getPrimitives()); 485 errors.removeIf(error -> error.getPrimitives().stream().anyMatch(deletedPrimitives::contains)); 490 if (filterRemovedPrimitives()) { 491 buildTree(); 486 492 } 487 493 } … … 512 518 513 519 @Override public void dataChanged(DataChangedEvent event) { 514 // Do nothing 515 } 520 if (filterRemovedPrimitives()) { 521 buildTree(); 522 } 523 } 524 525 /** 526 * Can be called to suppress execution of buildTree() while doing multiple updates. Caller must 527 * call resetErrors() to end this state. 528 * @since 14848 529 */ 530 public void setResetScheduled() { 531 resetScheduled = true; 532 } 533 534 /** 535 * Remove errors which refer to removed or purged primitives. 536 * @return true if error list was changed 537 */ 538 private boolean filterRemovedPrimitives() { 539 return errors != null && errors.removeIf( 540 error -> error.getPrimitives().stream().anyMatch(p -> p.isDeleted() || p.getDataSet() == null)); 541 } 542 516 543 }
Note:
See TracChangeset
for help on using the changeset viewer.