Changeset 18293 in josm


Ignore:
Timestamp:
2021-10-27T17:07:48+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21452 - fix #21462 - fix deadlock (patch by marcello)

File:
1 edited

Legend:

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

    r18276 r18293  
    112112import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
    113113import org.openstreetmap.josm.spi.preferences.Config;
    114 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    115114import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    116115import org.openstreetmap.josm.tools.AlphanumComparator;
     
    142141 */
    143142public class PropertiesDialog extends ToggleDialog
    144 implements DataSelectionListener, ActiveLayerChangeListener, DataSetListenerAdapter.Listener, PreferenceChangedListener, TaggingPresetListener {
     143implements DataSelectionListener, ActiveLayerChangeListener, DataSetListenerAdapter.Listener, TaggingPresetListener {
     144    private final BooleanProperty PROP_DISPLAY_DISCARDABLE_KEYS = new BooleanProperty("display.discardable-keys", false);
    145145
    146146    /**
     
    304304        editHelper.loadTagsIfNeeded();
    305305
    306         Config.getPref().addKeyPreferenceChangeListener("display.discardable-keys", this);
    307306        TaggingPresets.addListener(this);
    308307    }
     
    618617        membershipTable.removeMouseListener(popupMenuLauncher);
    619618        super.destroy();
    620         Config.getPref().removeKeyPreferenceChangeListener("display.discardable-keys", this);
    621619        TaggingPresets.removeListener(this);
    622620        Container parent = pluginHook.getParent();
     
    651649        tagData.setRowCount(0);
    652650
    653         final boolean displayDiscardableKeys = Config.getPref().getBoolean("display.discardable-keys", false);
     651        final boolean displayDiscardableKeys = PROP_DISPLAY_DISCARDABLE_KEYS.get();
    654652        final Map<String, Integer> keyCount = new HashMap<>();
    655653        final Map<String, String> tags = new HashMap<>();
     
    769767
    770768    /**
    771      * Re-load data when display preference change
     769     * Reloads data when the {@code display.discardable-keys} preference changes
    772770     */
    773771    @Override
    774772    public void preferenceChanged(PreferenceChangeEvent e) {
    775         if (MainApplication.getLayerManager().getActiveData() != null) {
    776             updateSelection();
    777         }
    778     }
    779 
     773        super.preferenceChanged(e);
     774        if (PROP_DISPLAY_DISCARDABLE_KEYS.getKey().equals(e.getKey())) {
     775            if (MainApplication.getLayerManager().getActiveData() != null) {
     776                updateSelection();
     777            }
     778        }
     779    }
    780780
    781781    /* ---------------------------------------------------------------------------------- */
Note: See TracChangeset for help on using the changeset viewer.