Changeset 3214 in josm for trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java
- Timestamp:
- 02.05.2010 18:12:34 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java
r3210 r3214 149 149 } 150 150 151 protected void appendOrUpdatePriority(AutoCompletionListItem to add) {152 AutoCompletionListItem item = valutToItemMap.get(to add.getValue());151 protected void appendOrUpdatePriority(AutoCompletionListItem toAdd) { 152 AutoCompletionListItem item = valutToItemMap.get(toAdd.getValue()); 153 153 if (item == null) { 154 154 // 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); 158 157 } 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())); 173 159 } 174 160 } … … 272 258 } 273 259 260 List<AutoCompletionListItem> getList() { 261 return Collections.unmodifiableList(list); 262 } 263 274 264 /** 275 265 * removes all elements from the auto completion list
Note: See TracChangeset
for help on using the changeset viewer.
