Ignore:
Timestamp:
02.05.2010 18:12:34 (2 years ago)
Author:
bastiK
Message:

autocompletion cleanup - fixes #2729

File:
1 edited

Legend:

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

    r3210 r3214  
    149149    } 
    150150 
    151     protected void appendOrUpdatePriority(AutoCompletionListItem toadd) { 
    152         AutoCompletionListItem item = valutToItemMap.get(toadd.getValue()); 
     151    protected void appendOrUpdatePriority(AutoCompletionListItem toAdd) { 
     152        AutoCompletionListItem item = valutToItemMap.get(toAdd.getValue()); 
    153153        if (item == null) { 
    154154            // new item does not exist yet. Add it to the list 
    155             // 
    156             list.add(toadd); 
    157             valutToItemMap.put(toadd.getValue(), toadd); 
     155            list.add(toAdd); 
     156            valutToItemMap.put(toAdd.getValue(), toAdd); 
    158157        } else { 
    159             // new item already exists. Update priority if necessary 
    160  
    161             // If it is both in the dataset and in the presets, update the priority. 
    162             final AutoCompletionItemPritority IS_IN_DATASET = AutoCompletionItemPritority.IS_IN_DATASET; 
    163             final AutoCompletionItemPritority IS_IN_STANDARD = AutoCompletionItemPritority.IS_IN_STANDARD; 
    164             if ((toadd.getPriority() == IS_IN_STANDARD && item.getPriority() == IS_IN_DATASET) || 
    165                 (toadd.getPriority() == IS_IN_DATASET && item.getPriority() == IS_IN_STANDARD)) { 
    166  
    167                 item.setPriority(AutoCompletionItemPritority.IS_IN_STANDARD_AND_IN_DATASET); 
    168             } else { 
    169                 if (toadd.getPriority().compareTo(item.getPriority()) < 0) { 
    170                     item.setPriority(toadd.getPriority()); 
    171                 } 
    172             } 
     158            item.setPriority(item.getPriority().mergeWith(toAdd.getPriority())); 
    173159        } 
    174160    } 
     
    272258    } 
    273259 
     260    List<AutoCompletionListItem> getList() { 
     261        return Collections.unmodifiableList(list); 
     262    } 
     263 
    274264    /** 
    275265     * removes all elements from the auto completion list 
Note: See TracChangeset for help on using the changeset viewer.