Changeset 3866 in josm


Ignore:
Timestamp:
Feb 7, 2011 2:50:48 PM (2 years ago)
Author:
bastiK
Message:

fixed #5876 (patch by ax) - AutoCompletingComboBox gets initialized with wrong value for "key:subkey" key elements in custom presets.xml

File:
1 edited

Legend:

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

    r3479 r3866  
    8585            } 
    8686 
     87            // the string being inserted might be a "full" string from the list 
     88            // of valid completions (instanceof AutoCompletionListItem), or a 
     89            // "partial" string being typed (instanceof String). 
     90            Object item = comboBox.getSelectedItem(); 
     91            if (item != null && (item instanceof String || !curText.equals(((AutoCompletionListItem) item).getValue()))) { 
     92                // only in the latter case do we have to 
    8793            // lookup and select a matching item 
    88             Object item = lookupItem(curText); 
     94                item = lookupItem(curText); 
    8995            setSelectedItem(item); 
     96            } 
    9097            if (initial) { 
    9198                start = 0; 
     
    114121        } 
    115122 
    116         private Object lookupItem(String pattern) { 
     123        private AutoCompletionListItem lookupItem(String pattern) { 
    117124            ComboBoxModel model = comboBox.getModel(); 
    118125            AutoCompletionListItem bestItem = null; 
Note: See TracChangeset for help on using the changeset viewer.