Changeset 2055 in josm for trunk/src/org/openstreetmap/josm/gui/tagging
- Timestamp:
- 2009-09-04T19:47:18+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r2048 r2055 68 68 public String locale_name; 69 69 70 private static AutoCompletionList autoCompletionList; 71 72 public static AutoCompletionList getPresetAutocompletionList() { 73 if (autoCompletionList == null) { 74 autoCompletionList = new AutoCompletionList(); 75 } 76 return autoCompletionList; 77 } 78 70 79 public static abstract class Item { 71 80 protected void initAutoCompletionField(AutoCompletingTextField field, String key) { 72 81 OsmDataLayer layer = Main.main.getEditLayer(); 73 82 if (layer == null) return; 74 AutoCompletionCache cache = AutoCompletionCache.getCacheForLayer(layer); 75 AutoCompletionList list = new AutoCompletionList(); 76 cache.populateWithValues(list, false /* don't append */); 77 field.setAutoCompletionList(list); 83 field.setAutoCompletionList(getPresetAutocompletionList()); 78 84 } 79 85 … … 640 646 } 641 647 648 protected void refreshAutocompletionList(final OsmDataLayer layer) { 649 Runnable task = new Runnable() { 650 public void run() { 651 System.out.print("refreshing preset auto completion list ..."); 652 AutoCompletionCache.getCacheForLayer(layer).initFromDataSet(); 653 AutoCompletionCache.getCacheForLayer(layer).populateWithValues( getPresetAutocompletionList(), false /* don't append */); 654 System.out.println("DONE"); 655 } 656 }; 657 new Thread(task).run(); 658 659 } 642 660 public PresetPanel createPanel(Collection<OsmPrimitive> selected) { 643 661 if (data == null) … … 645 663 OsmDataLayer layer = Main.main.getEditLayer(); 646 664 if (layer != null) { 647 AutoCompletionCache.getCacheForLayer(layer).initFromDataSet();665 refreshAutocompletionList(layer); 648 666 } 649 667 PresetPanel p = new PresetPanel();
Note:
See TracChangeset
for help on using the changeset viewer.