Changeset 16091 in josm


Ignore:
Timestamp:
2020-03-08T20:32:18+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #18658 - Don't create empty validator layer

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ValidateAction.java

    r15976 r16091  
    6868
    6969        OsmValidator.initializeTests();
    70         OsmValidator.initializeErrorLayer();
    7170
    7271        Collection<Test> tests = OsmValidator.getEnabledTests(false);
     
    144143                map.validatorDialog.unfurlDialog();
    145144                map.validatorDialog.tree.setErrors(errors);
    146                 //FIXME: nicer way to find / invalidate the corresponding error layer
    147                 MainApplication.getLayerManager().getLayersOfType(ValidatorLayer.class).forEach(ValidatorLayer::invalidate);
     145                if (!errors.isEmpty()) {
     146                    //FIXME: nicer way to find / invalidate the corresponding error layer
     147                    OsmValidator.initializeErrorLayer();
     148                    MainApplication.getLayerManager().getLayersOfType(ValidatorLayer.class).forEach(ValidatorLayer::invalidate);
     149                }
    148150            });
    149151        }
     
    154156            if (tests == null || tests.isEmpty())
    155157                return;
    156             errors = new ArrayList<>(200);
     158            errors = new ArrayList<>();
    157159            getProgressMonitor().setTicksCount(tests.size() * validatedPrimitives.size());
    158160            int testCounter = 0;
     
    171173            }
    172174            tests = null;
    173             if (ValidatorPrefHelper.PREF_USE_IGNORE.get()) {
     175            if (Boolean.TRUE.equals(ValidatorPrefHelper.PREF_USE_IGNORE.get())) {
    174176                getProgressMonitor().setCustomText("");
    175177                getProgressMonitor().subTask(tr("Updating ignored errors ..."));
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r16069 r16091  
    486486     */
    487487    public static synchronized void initializeErrorLayer() {
    488         if (!ValidatorPrefHelper.PREF_LAYER.get())
    489             return;
    490         if (errorLayer == null) {
     488        if (errorLayer == null && Boolean.TRUE.equals(ValidatorPrefHelper.PREF_LAYER.get())) {
    491489            errorLayer = new ValidatorLayer();
    492490            MainApplication.getLayerManager().addLayer(errorLayer);
Note: See TracChangeset for help on using the changeset viewer.