Changeset 18951 in josm for trunk/src/org


Ignore:
Timestamp:
2024-01-23T10:55:17+01:00 (10 months ago)
Author:
GerdP
Message:

fix #23430: Resetting preference validator.selectionFilter results in broken validator

  • always set filter when selection was changed
  • updateSelection when preferences were changed so that a change of the preference validator.selectionFilter is applied immediately
File:
1 edited

Legend:

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

    r17896 r18951  
    6969import org.openstreetmap.josm.io.OsmTransferException;
    7070import org.openstreetmap.josm.spi.preferences.Config;
     71import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    7172import org.openstreetmap.josm.tools.ImageProvider;
    7273import org.openstreetmap.josm.tools.InputMapUtils;
     
    588589     */
    589590    public void updateSelection(Collection<? extends OsmPrimitive> newSelection) {
    590         if (!Config.getPref().getBoolean(ValidatorPrefHelper.PREF_FILTER_BY_SELECTION, false))
    591             return;
    592         if (newSelection.isEmpty()) {
     591        if (newSelection.isEmpty() || !Config.getPref().getBoolean(ValidatorPrefHelper.PREF_FILTER_BY_SELECTION, false))
    593592            tree.setFilter(null);
    594         }
    595         tree.setFilter(new HashSet<>(newSelection));
     593        else
     594            tree.setFilter(new HashSet<>(newSelection));
    596595    }
    597596
     
    731730        }
    732731    }
     732
     733    @Override
     734    public void preferenceChanged(PreferenceChangeEvent e) {
     735        super.preferenceChanged(e);
     736        // see #23430: update selection so that filters are applied
     737        DataSet ds = MainApplication.getLayerManager().getActiveDataSet();
     738        if (ds != null) {
     739            updateSelection(ds.getAllSelected());
     740        }
     741
     742    }
     743
    733744}
Note: See TracChangeset for help on using the changeset viewer.