Changeset 3214 in josm for trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.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/AutoCompletionManager.java
r3213 r3214 109 109 110 110 protected void cachePrimitives(Collection<? extends OsmPrimitive> primitives) { 111 if (tagCache == null) {112 // We are coming from a DataSetListener event and113 // rebuild has not been called yet, so do it now and114 // ignore the method parameter.115 rebuild();116 return;117 }118 111 for (OsmPrimitive primitive : primitives) { 119 112 cachePrimitiveTags(primitive); … … 204 197 } 205 198 206 public TreeSet<String> getKeys(Comparator<String> c) {207 TreeSet<String> ret = new TreeSet<String>(c);208 ret.addAll(getDataKeys());209 ret.addAll(getPresetKeys());210 return ret;211 }212 213 199 /** 214 200 * replies the auto completion values allowed for a specific key. Replies … … 226 212 } 227 213 228 public TreeSet<String> getValues(String key, Comparator<String> c) {229 TreeSet<String> ret = new TreeSet<String>(c);230 ret.addAll(getDataValues(key));231 ret.addAll(getPresetValues(key));232 return ret;233 }234 235 214 /** 236 215 * Replies the list of member roles … … 249 228 */ 250 229 public void populateWithMemberRoles(AutoCompletionList list) { 251 list.clear();252 230 list.add(getRoleCache(), AutoCompletionItemPritority.IS_IN_DATASET); 231 } 232 233 /** 234 * Populates the an {@see AutoCompletionList} with the currently cached 235 * tag keys 236 * 237 * @param list the list to populate 238 * @param append true to add the keys to the list; false, to replace the keys 239 * in the list by the keys in the cache 240 */ 241 public void populateWithKeys(AutoCompletionList list) { 242 list.add(getPresetKeys(), AutoCompletionItemPritority.IS_IN_STANDARD); 243 list.add(getDataKeys(), AutoCompletionItemPritority.IS_IN_DATASET); 253 244 } 254 245 … … 263 254 */ 264 255 public void populateWithTagValues(AutoCompletionList list, String key) { 256 list.add(getPresetValues(key), AutoCompletionItemPritority.IS_IN_STANDARD); 265 257 list.add(getDataValues(key), AutoCompletionItemPritority.IS_IN_DATASET); 266 list.add(getPresetValues(key), AutoCompletionItemPritority.IS_IN_STANDARD); 267 } 268 269 /** 270 * Populates the an {@see AutoCompletionList} with the currently cached 271 * tag keys 272 * 273 * @param list the list to populate 274 * @param append true to add the keys to the list; false, to replace the keys 275 * in the list by the keys in the cache 276 */ 277 public void populateWithKeys(AutoCompletionList list) { 278 list.add(getDataKeys(), AutoCompletionItemPritority.IS_IN_DATASET); 279 list.add(getPresetKeys(), AutoCompletionItemPritority.IS_IN_STANDARD); 258 } 259 260 public List<AutoCompletionListItem> getKeys() { 261 AutoCompletionList list = new AutoCompletionList(); 262 populateWithKeys(list); 263 return new ArrayList<AutoCompletionListItem>(list.getList()); 264 } 265 266 public List<AutoCompletionListItem> getValues(String key) { 267 AutoCompletionList list = new AutoCompletionList(); 268 populateWithTagValues(list, key); 269 return new ArrayList<AutoCompletionListItem>(list.getList()); 280 270 } 281 271 … … 286 276 287 277 public void primtivesAdded(PrimitivesAddedEvent event) { 278 if (dirty) 279 return; 288 280 cachePrimitives(event.getPrimitives()); 289 281 } … … 294 286 295 287 public void tagsChanged(TagsChangedEvent event) { 288 if (dirty) 289 return; 296 290 Map<String, String> newKeys = event.getPrimitive().getKeys(); 297 291 Map<String, String> oldKeys = event.getOriginalKeys();
Note: See TracChangeset
for help on using the changeset viewer.
