Changeset 18867 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r18691 r18867 42 42 43 43 /** The collection of tagging presets */ 44 private static final Collection<TaggingPreset> taggingPresets= new ArrayList<>();44 private static final List<TaggingPreset> TAGGING_PRESETS = new ArrayList<>(); 45 45 46 46 /** cache for key/value pairs found in the preset */ … … 69 69 */ 70 70 public static void readFromPreferences() { 71 taggingPresets.clear();72 taggingPresets.addAll(TaggingPresetReader.readFromPreferences(false, false));73 cachePresets( taggingPresets);71 TAGGING_PRESETS.clear(); 72 TAGGING_PRESETS.addAll(TaggingPresetReader.readFromPreferences(false, false)); 73 cachePresets(TAGGING_PRESETS); 74 74 } 75 75 … … 89 89 90 90 readFromPreferences(); 91 final List<TaggingPreset> activeLayerChangeListeners = new ArrayList<>( taggingPresets.size());92 for (TaggingPreset tp: taggingPresets) {91 final List<TaggingPreset> activeLayerChangeListeners = new ArrayList<>(TAGGING_PRESETS.size()); 92 for (TaggingPreset tp: TAGGING_PRESETS) { 93 93 if (!(tp instanceof TaggingPresetSeparator)) { 94 94 MainApplication.getToolbar().register(tp); … … 97 97 } 98 98 MainApplication.getLayerManager().addActiveLayerChangeListeners(activeLayerChangeListeners); 99 if ( taggingPresets.isEmpty()) {99 if (TAGGING_PRESETS.isEmpty()) { 100 100 presetsMenu.setVisible(false); 101 101 } else { 102 102 Map<TaggingPresetMenu, JMenu> submenus = new HashMap<>(); 103 for (final TaggingPreset p : taggingPresets) {103 for (final TaggingPreset p : TAGGING_PRESETS) { 104 104 JMenu m = p.group != null ? submenus.get(p.group) : presetsMenu; 105 105 if (m == null && p.group != null) { … … 127 127 } 128 128 } 129 if ( SORT_MENU.get()) {129 if (Boolean.TRUE.equals(SORT_MENU.get())) { 130 130 TaggingPresetMenu.sortMenu(presetsMenu); 131 131 } … … 142 142 public static void destroy() { 143 143 ToolbarPreferences toolBar = MainApplication.getToolbar(); 144 for (TaggingPreset tp: taggingPresets) {144 for (TaggingPreset tp: TAGGING_PRESETS) { 145 145 toolBar.unregister(tp); 146 146 if (!(tp instanceof TaggingPresetSeparator)) { … … 148 148 } 149 149 } 150 taggingPresets.clear();150 TAGGING_PRESETS.clear(); 151 151 PRESET_TAG_CACHE.clear(); 152 152 PRESET_ROLE_CACHE.clear(); … … 191 191 */ 192 192 public static Collection<TaggingPreset> getTaggingPresets() { 193 return Collections.unmodifiable Collection(taggingPresets);193 return Collections.unmodifiableList(TAGGING_PRESETS); 194 194 } 195 195 … … 264 264 */ 265 265 public static void addTaggingPresets(Collection<TaggingPreset> presets) { 266 if (presets != null && taggingPresets.addAll(presets)) {266 if (presets != null && TAGGING_PRESETS.addAll(presets)) { 267 267 listeners.forEach(TaggingPresetListener::taggingPresetsModified); 268 268 }
Note:
See TracChangeset
for help on using the changeset viewer.