Changeset 5483 in josm


Ignore:
Timestamp:
2012-08-30T21:40:23+02:00 (12 years ago)
Author:
Don-vip
Message:

see #8012 - fix #8013 - Fix bad handling of Strings in AutoCompletingBoxes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletingComboBox.java

    r5479 r5483  
    222222    public void setPossibleItems(Collection<String> elems) {
    223223        DefaultComboBoxModel model = (DefaultComboBoxModel)this.getModel();
    224         Object oldValue = getSelectedItem();
     224        Object oldValue = this.getEditor().getItem(); // Do not use getSelectedItem(); (fix #8013)
    225225        model.removeAllElements();
    226226        for (String elem : elems) {
     
    230230        // AutoCompletingComboBoxDocument#insertString
    231231        autocompleteEnabled = false;
    232         setSelectedItem(oldValue);
     232        this.getEditor().setItem(oldValue); // Do not use setSelectedItem(oldValue); (fix #8013)
    233233        autocompleteEnabled = true;
    234234    }
     
    240240        DefaultComboBoxModel model = (DefaultComboBoxModel)this.getModel();
    241241        Object oldValue = getSelectedItem();
     242        Object editorOldValue = this.getEditor().getItem();
    242243        model.removeAllElements();
    243244        for (AutoCompletionListItem elem : elems) {
     
    245246        }
    246247        setSelectedItem(oldValue);
     248        this.getEditor().setItem(editorOldValue);
    247249    }
    248250
Note: See TracChangeset for help on using the changeset viewer.