Changeset 16089 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2020-03-08T20:17:00+01:00 (5 years ago)
Author:
simon04
Message:

fix #18867 - Presets: combo does not show <DIFFERENT>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r16063 r16089  
    363363    @Override
    364364    public Collection<String> getValues() {
    365         initListEntries();
     365        initListEntries(false);
    366366        return presetListEntries.stream().map(x -> x.value).collect(Collectors.toSet());
    367367    }
     
    372372     */
    373373    public Collection<String> getDisplayValues() {
    374         initListEntries();
     374        initListEntries(false);
    375375        return presetListEntries.stream().map(PresetListEntry::getDisplayValue).collect(Collectors.toList());
    376376    }
     
    378378    @Override
    379379    public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel, boolean presetInitiallyMatches) {
    380         initListEntries();
     380        initListEntries(true);
    381381
    382382        // find out if our key is already used in the selection.
     
    396396    }
    397397
    398     private void initListEntries() {
     398    private void initListEntries(boolean cleanup) {
    399399        if (initialized) {
    400             presetListEntries.remove(new PresetListEntry(DIFFERENT)); // possibly added in #addToPanel
     400            if (cleanup) { // do not cleanup for #getDisplayValues used in Combo#addToPanelAnchor
     401                presetListEntries.remove(new PresetListEntry(DIFFERENT)); // possibly added in #addToPanel
     402            }
    401403            return;
    402404        } else if (presetListEntries.isEmpty()) {
Note: See TracChangeset for help on using the changeset viewer.