Changeset 17437 in josm


Ignore:
Timestamp:
2021-01-04T12:12:03+01:00 (12 days ago)
Author:
GerdP
Message:

fix #20342: Validator results not cleared

  • add code to make sure that invalidation listeners are called when buildTree is called even if the tree is empty

The new method buildTreeInternal() is not strictly needed but I think it was too easy to add a return statement somewhere without looking at the very end of the complex method and thus skipping the line
invalidationListeners.fireEvent(Runnable::run);

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java

    r16079 r17437  
    168168        if (resetScheduled)
    169169            return;
     170        buildTreeInternal(expandAgain);
     171        invalidationListeners.fireEvent(Runnable::run);
     172    }
     173
     174    private void buildTreeInternal(boolean expandAgain) {
    170175        final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
    171176
    172         if (errors == null || errors.isEmpty()) {
    173             GuiHelper.runInEDTAndWait(() -> valTreeModel.setRoot(rootNode));
    174             return;
    175         }
     177        if (errors == null)
     178            errors = new ArrayList<>();
    176179
    177180        // Remember first selected tree row
     
    199202
    200203        Predicate<TestError> filterToUse = e -> !e.isIgnored();
    201         if (!ValidatorPrefHelper.PREF_OTHER.get()) {
     204        if (!Boolean.TRUE.equals(ValidatorPrefHelper.PREF_OTHER.get())) {
    202205            filterToUse = filterToUse.and(e -> e.getSeverity() != Severity.OTHER);
    203206        }
     
    326329            scrollRowToVisible(selRow);
    327330        }
    328 
    329         invalidationListeners.fireEvent(Runnable::run);
    330331    }
    331332
Note: See TracChangeset for help on using the changeset viewer.