Changeset 12542 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-07-30T17:07:42+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java
r12537 r12542 30 30 31 31 // TODO: Switch to checked list. We can do this as soon as we do not see any more warnings. 32 private static final ListenerList<ExpertModeChangeListener> LISTENERS= ListenerList.createUnchecked();33 private static final ListenerList<Component> VISIBILITY_TOGGLE_LISTENERS= ListenerList.createUnchecked();32 private static final ListenerList<ExpertModeChangeListener> listeners = ListenerList.createUnchecked(); 33 private static final ListenerList<Component> visibilityToggleListeners = ListenerList.createUnchecked(); 34 34 35 35 private static final BooleanProperty PREF_EXPERT = new BooleanProperty("expert", false); … … 38 38 39 39 private static synchronized void fireExpertModeChanged(boolean isExpert) { 40 LISTENERS.fireEvent(listener -> listener.expertChanged(isExpert));41 VISIBILITY_TOGGLE_LISTENERS.fireEvent(c -> c.setVisible(isExpert));40 listeners.fireEvent(listener -> listener.expertChanged(isExpert)); 41 visibilityToggleListeners.fireEvent(c -> c.setVisible(isExpert)); 42 42 } 43 43 … … 53 53 public static synchronized void addExpertModeChangeListener(ExpertModeChangeListener listener, boolean fireWhenAdding) { 54 54 if (listener == null) return; 55 LISTENERS.addWeakListener(listener);55 listeners.addWeakListener(listener); 56 56 if (fireWhenAdding) { 57 57 listener.expertChanged(isExpert()); … … 66 66 public static synchronized void removeExpertModeChangeListener(ExpertModeChangeListener listener) { 67 67 if (listener == null) return; 68 LISTENERS.removeListener(listener);68 listeners.removeListener(listener); 69 69 } 70 70 … … 75 75 public static synchronized void addVisibilitySwitcher(Component c) { 76 76 if (c == null) return; 77 VISIBILITY_TOGGLE_LISTENERS.addWeakListener(c);77 visibilityToggleListeners.addWeakListener(c); 78 78 c.setVisible(isExpert()); 79 79 } … … 86 86 public static synchronized void removeVisibilitySwitcher(Component c) { 87 87 if (c == null) return; 88 VISIBILITY_TOGGLE_LISTENERS.removeListener(c);88 visibilityToggleListeners.removeListener(c); 89 89 } 90 90 -
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r12537 r12542 42 42 * @since 4869 43 43 */ 44 private static final ArrayList<FileImporter> IMPORTERS;44 private static final ArrayList<FileImporter> importers; 45 45 46 46 /** … … 48 48 * @since 4869 49 49 */ 50 private static final ArrayList<FileExporter> EXPORTERS;50 private static final ArrayList<FileExporter> exporters; 51 51 52 52 // add some file types only if the relevant classes are there. … … 56 56 static { 57 57 58 IMPORTERS= new ArrayList<>();58 importers = new ArrayList<>(); 59 59 60 60 final List<Class<? extends FileImporter>> importerNames = Arrays.asList( … … 73 73 try { 74 74 FileImporter importer = importerClass.getConstructor().newInstance(); 75 IMPORTERS.add(importer);75 importers.add(importer); 76 76 } catch (ReflectiveOperationException e) { 77 77 Main.debug(e); … … 95 95 } 96 96 97 EXPORTERS= new ArrayList<>();97 exporters = new ArrayList<>(); 98 98 99 99 final List<Class<? extends FileExporter>> exporterClasses = Arrays.asList( … … 110 110 try { 111 111 FileExporter exporter = exporterClass.getConstructor().newInstance(); 112 EXPORTERS.add(exporter);112 exporters.add(exporter); 113 113 Main.getLayerManager().addAndFireActiveLayerChangeListener(exporter); 114 114 } catch (ReflectiveOperationException e) { … … 147 147 public static void addImporter(FileImporter importer) { 148 148 if (importer != null) { 149 IMPORTERS.add(importer);149 importers.add(importer); 150 150 } 151 151 } … … 158 158 public static void addImporterFirst(FileImporter importer) { 159 159 if (importer != null) { 160 IMPORTERS.add(0, importer);160 importers.add(0, importer); 161 161 } 162 162 } … … 169 169 public static void addExporter(FileExporter exporter) { 170 170 if (exporter != null) { 171 EXPORTERS.add(exporter);171 exporters.add(exporter); 172 172 } 173 173 } … … 180 180 public static void addExporterFirst(FileExporter exporter) { 181 181 if (exporter != null) { 182 EXPORTERS.add(0, exporter);182 exporters.add(0, exporter); 183 183 } 184 184 } … … 190 190 */ 191 191 public static List<FileImporter> getImporters() { 192 return Collections.unmodifiableList( IMPORTERS);192 return Collections.unmodifiableList(importers); 193 193 } 194 194 … … 199 199 */ 200 200 public static List<FileExporter> getExporters() { 201 return Collections.unmodifiableList( EXPORTERS);201 return Collections.unmodifiableList(exporters); 202 202 } 203 203 … … 213 213 */ 214 214 public static void updateAllFormatsImporter() { 215 for (int i = 0; i < IMPORTERS.size(); i++) {216 if ( IMPORTERS.get(i) instanceof AllFormatsImporter) {217 IMPORTERS.set(i, new AllFormatsImporter());215 for (int i = 0; i < importers.size(); i++) { 216 if (importers.get(i) instanceof AllFormatsImporter) { 217 importers.set(i, new AllFormatsImporter()); 218 218 } 219 219 } … … 231 231 updateAllFormatsImporter(); 232 232 List<ExtensionFileFilter> filters = new LinkedList<>(); 233 for (FileImporter importer : IMPORTERS) {233 for (FileImporter importer : importers) { 234 234 filters.add(importer.filter); 235 235 } … … 248 248 public static List<ExtensionFileFilter> getExportExtensionFileFilters() { 249 249 List<ExtensionFileFilter> filters = new LinkedList<>(); 250 for (FileExporter exporter : EXPORTERS) {250 for (FileExporter exporter : exporters) { 251 251 if (filters.contains(exporter.filter) || !exporter.isEnabled()) { 252 252 continue; … … 267 267 public static ExtensionFileFilter getDefaultImportExtensionFileFilter(String extension) { 268 268 if (extension == null) return new AllFormatsImporter().filter; 269 for (FileImporter importer : IMPORTERS) {269 for (FileImporter importer : importers) { 270 270 if (extension.equals(importer.filter.getDefaultExtension())) 271 271 return importer.filter; … … 283 283 public static ExtensionFileFilter getDefaultExportExtensionFileFilter(String extension) { 284 284 if (extension == null) return new AllFormatsImporter().filter; 285 for (FileExporter exporter : EXPORTERS) {285 for (FileExporter exporter : exporters) { 286 286 if (extension.equals(exporter.filter.getDefaultExtension())) 287 287 return exporter.filter; … … 290 290 // scan all supported extensions 291 291 File file = new File("file." + extension); 292 for (FileExporter exporter : EXPORTERS) {292 for (FileExporter exporter : exporters) { 293 293 if (exporter.filter.accept(file)) 294 294 return exporter.filter; -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r12537 r12542 75 75 * Remember movements, so the user can later undo it for certain nodes 76 76 */ 77 private static final Map<Node, EastNorth> REMEMBER_MOVEMENTS= new HashMap<>();77 private static final Map<Node, EastNorth> rememberMovements = new HashMap<>(); 78 78 79 79 /** … … 108 108 if (!(p instanceof Node)) throw new InvalidUserInputException("selected object is not a node"); 109 109 Node n = (Node) p; 110 if ( REMEMBER_MOVEMENTS.containsKey(n)) {111 EastNorth tmp = REMEMBER_MOVEMENTS.get(n);110 if (rememberMovements.containsKey(n)) { 111 EastNorth tmp = rememberMovements.get(n); 112 112 commands.add(new MoveCommand(n, -tmp.east(), -tmp.north())); 113 REMEMBER_MOVEMENTS.remove(n);113 rememberMovements.remove(n); 114 114 } 115 115 } … … 209 209 } else { 210 210 if (nodeList.size() == 2 || nodeList.isEmpty()) { 211 REMEMBER_MOVEMENTS.clear();211 OrthogonalizeAction.rememberMovements.clear(); 212 212 final Collection<Command> commands = new LinkedList<>(); 213 213 … … 424 424 throw new AssertionError("heading node has changed"); 425 425 } else { 426 REMEMBER_MOVEMENTS.put(n, new EastNorth(dx, dy));426 OrthogonalizeAction.rememberMovements.put(n, new EastNorth(dx, dy)); 427 427 commands.add(new MoveCommand(n, dx, dy)); 428 428 } -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r12537 r12542 125 125 } 126 126 127 private static final LinkedList<SearchSetting> SEARCH_HISTORY= new LinkedList<>();127 private static final LinkedList<SearchSetting> searchHistory = new LinkedList<>(); 128 128 static { 129 129 for (String s: Main.pref.getCollection("search.history", Collections.<String>emptyList())) { 130 130 SearchSetting ss = SearchSetting.readFromString(s); 131 131 if (ss != null) { 132 SEARCH_HISTORY.add(ss);132 searchHistory.add(ss); 133 133 } 134 134 } … … 140 140 */ 141 141 public static Collection<SearchSetting> getSearchHistory() { 142 return SEARCH_HISTORY;142 return searchHistory; 143 143 } 144 144 … … 148 148 */ 149 149 public static void saveToHistory(SearchSetting s) { 150 if ( SEARCH_HISTORY.isEmpty() || !s.equals(SEARCH_HISTORY.getFirst())) {151 SEARCH_HISTORY.addFirst(new SearchSetting(s));152 } else if ( SEARCH_HISTORY.contains(s)) {150 if (searchHistory.isEmpty() || !s.equals(searchHistory.getFirst())) { 151 searchHistory.addFirst(new SearchSetting(s)); 152 } else if (searchHistory.contains(s)) { 153 153 // move existing entry to front, fixes #8032 - search history loses entries when re-using queries 154 SEARCH_HISTORY.remove(s);155 SEARCH_HISTORY.addFirst(new SearchSetting(s));154 searchHistory.remove(s); 155 searchHistory.addFirst(new SearchSetting(s)); 156 156 } 157 157 int maxsize = Main.pref.getInteger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE); 158 while ( SEARCH_HISTORY.size() > maxsize) {159 SEARCH_HISTORY.removeLast();160 } 161 Set<String> savedHistory = new LinkedHashSet<>( SEARCH_HISTORY.size());162 for (SearchSetting item: SEARCH_HISTORY) {158 while (searchHistory.size() > maxsize) { 159 searchHistory.removeLast(); 160 } 161 Set<String> savedHistory = new LinkedHashSet<>(searchHistory.size()); 162 for (SearchSetting item: searchHistory) { 163 163 savedHistory.add(item.writeToString()); 164 164 } -
trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java
r12537 r12542 80 80 } 81 81 82 private static final CopyOnWriteArrayList<SoMChangeListener> SOM_CHANGE_LISTENERS= new CopyOnWriteArrayList<>();82 private static final CopyOnWriteArrayList<SoMChangeListener> somChangeListeners = new CopyOnWriteArrayList<>(); 83 83 84 84 /** … … 89 89 */ 90 90 public static void removeSoMChangeListener(SoMChangeListener listener) { 91 SOM_CHANGE_LISTENERS.remove(listener);91 somChangeListeners.remove(listener); 92 92 } 93 93 … … 100 100 public static void addSoMChangeListener(SoMChangeListener listener) { 101 101 if (listener != null) { 102 SOM_CHANGE_LISTENERS.addIfAbsent(listener);102 somChangeListeners.addIfAbsent(listener); 103 103 } 104 104 } 105 105 106 106 protected static void fireSoMChanged(String oldSoM, String newSoM) { 107 for (SoMChangeListener l : SOM_CHANGE_LISTENERS) {107 for (SoMChangeListener l : somChangeListeners) { 108 108 l.systemOfMeasurementChanged(oldSoM, newSoM); 109 109 } -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r12537 r12542 81 81 82 82 83 private static final ConcurrentMap<String, Set<ICachedLoaderListener>> IN_PROGRESS= new ConcurrentHashMap<>();84 private static final ConcurrentMap<String, Boolean> USE_HEAD= new ConcurrentHashMap<>();83 private static final ConcurrentMap<String, Set<ICachedLoaderListener>> inProgress = new ConcurrentHashMap<>(); 84 private static final ConcurrentMap<String, Boolean> useHead = new ConcurrentHashMap<>(); 85 85 86 86 protected final long now; // when the job started … … 162 162 throw new IllegalArgumentException("No url returned"); 163 163 } 164 synchronized ( IN_PROGRESS) {165 Set<ICachedLoaderListener> newListeners = IN_PROGRESS.get(deduplicationKey);164 synchronized (inProgress) { 165 Set<ICachedLoaderListener> newListeners = inProgress.get(deduplicationKey); 166 166 if (newListeners == null) { 167 167 newListeners = new HashSet<>(); 168 IN_PROGRESS.put(deduplicationKey, newListeners);168 inProgress.put(deduplicationKey, newListeners); 169 169 first = true; 170 170 } … … 259 259 private void finishLoading(LoadResult result) { 260 260 Set<ICachedLoaderListener> listeners; 261 synchronized ( IN_PROGRESS) {261 synchronized (inProgress) { 262 262 try { 263 listeners = IN_PROGRESS.remove(getUrl().toString());263 listeners = inProgress.remove(getUrl().toString()); 264 264 } catch (IOException e) { 265 265 listeners = null; … … 312 312 // then just use HEAD request and check returned values 313 313 if (isObjectLoadable() && 314 Boolean.TRUE.equals( USE_HEAD.get(getServerKey())) &&314 Boolean.TRUE.equals(useHead.get(getServerKey())) && 315 315 isCacheValidUsingHead()) { 316 316 LOG.log(Level.FINE, "JCS - cache entry verified using HEAD request: {0}", getUrl()); … … 346 346 LOG.log(Level.INFO, "JCS - Host: {0} found not to return 304 codes for If-Modified-Since or If-None-Match headers", 347 347 serverKey); 348 USE_HEAD.put(serverKey, Boolean.TRUE);348 useHead.put(serverKey, Boolean.TRUE); 349 349 } 350 350 -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r12537 r12542 51 51 // we need another deduplication of Tile Loader listeners, as for each submit, new TMSCachedTileLoaderJob was created 52 52 // that way, we reduce calls to tileLoadingFinished, and general CPU load due to surplus Map repaints 53 private static final ConcurrentMap<String, Set<TileLoaderListener>> IN_PROGRESS= new ConcurrentHashMap<>();53 private static final ConcurrentMap<String, Set<TileLoaderListener>> inProgress = new ConcurrentHashMap<>(); 54 54 55 55 /** … … 71 71 if (listener != null) { 72 72 String deduplicationKey = getCacheKey(); 73 synchronized ( IN_PROGRESS) {74 Set<TileLoaderListener> newListeners = IN_PROGRESS.get(deduplicationKey);73 synchronized (inProgress) { 74 Set<TileLoaderListener> newListeners = inProgress.get(deduplicationKey); 75 75 if (newListeners == null) { 76 76 newListeners = new HashSet<>(); 77 IN_PROGRESS.put(deduplicationKey, newListeners);77 inProgress.put(deduplicationKey, newListeners); 78 78 } 79 79 newListeners.add(listener); … … 162 162 this.attributes = attributes; // as we might get notification from other object than our selfs, pass attributes along 163 163 Set<TileLoaderListener> listeners; 164 synchronized ( IN_PROGRESS) {165 listeners = IN_PROGRESS.remove(getCacheKey());164 synchronized (inProgress) { 165 listeners = inProgress.remove(getCacheKey()); 166 166 } 167 167 boolean status = result.equals(LoadResult.SUCCESS); -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r12536 r12542 47 47 } 48 48 49 private static final AtomicLong ID_COUNTER= new AtomicLong(0);49 private static final AtomicLong idCounter = new AtomicLong(0); 50 50 51 51 /** … … 54 54 */ 55 55 static long generateUniqueId() { 56 return ID_COUNTER.decrementAndGet();56 return idCounter.decrementAndGet(); 57 57 } 58 58 … … 63 63 */ 64 64 public static long currentUniqueId() { 65 return ID_COUNTER.get();65 return idCounter.get(); 66 66 } 67 67 … … 76 76 throw new IllegalArgumentException("Cannot modify the id counter backwards"); 77 77 } 78 ID_COUNTER.set(newId);78 idCounter.set(newId); 79 79 } 80 80 -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r12537 r12542 638 638 * dataset. (However, the selection does only change in the active layer) 639 639 */ 640 private static final Collection<SelectionChangedListener> SEL_LISTENERS= new CopyOnWriteArrayList<>();640 private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<>(); 641 641 642 642 /** … … 647 647 */ 648 648 public static void addSelectionListener(SelectionChangedListener listener) { 649 ((CopyOnWriteArrayList<SelectionChangedListener>) SEL_LISTENERS).addIfAbsent(listener);649 ((CopyOnWriteArrayList<SelectionChangedListener>) selListeners).addIfAbsent(listener); 650 650 } 651 651 … … 657 657 */ 658 658 public static void removeSelectionListener(SelectionChangedListener listener) { 659 SEL_LISTENERS.remove(listener);659 selListeners.remove(listener); 660 660 } 661 661 … … 671 671 672 672 private static void fireDreprecatedSelectionChange(Collection<? extends OsmPrimitive> currentSelection) { 673 for (SelectionChangedListener l : SEL_LISTENERS) {673 for (SelectionChangedListener l : selListeners) { 674 674 l.selectionChanged(currentSelection); 675 675 } -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r12537 r12542 79 79 private static double griddetail; 80 80 81 private static final Collection<String> IGNORED_ERRORS= new TreeSet<>();81 private static final Collection<String> ignoredErrors = new TreeSet<>(); 82 82 83 83 /** 84 84 * All registered tests 85 85 */ 86 private static final Collection<Class<? extends Test>> ALL_TESTS= new ArrayList<>();87 private static final Map<String, Test> ALL_TESTS_MAP= new HashMap<>();86 private static final Collection<Class<? extends Test>> allTests = new ArrayList<>(); 87 private static final Map<String, Test> allTestsMap = new HashMap<>(); 88 88 89 89 /** … … 139 139 */ 140 140 public static void addTest(Class<? extends Test> testClass) { 141 ALL_TESTS.add(testClass);141 allTests.add(testClass); 142 142 try { 143 ALL_TESTS_MAP.put(testClass.getName(), testClass.getConstructor().newInstance());143 allTestsMap.put(testClass.getName(), testClass.getConstructor().newInstance()); 144 144 } catch (ReflectiveOperationException e) { 145 145 Main.error(e); … … 182 182 183 183 private static void loadIgnoredErrors() { 184 IGNORED_ERRORS.clear();184 ignoredErrors.clear(); 185 185 if (ValidatorPreference.PREF_USE_IGNORE.get()) { 186 186 Path path = Paths.get(getValidatorDir()).resolve("ignorederrors"); 187 187 if (path.toFile().exists()) { 188 188 try { 189 IGNORED_ERRORS.addAll(Files.readAllLines(path, StandardCharsets.UTF_8));189 ignoredErrors.addAll(Files.readAllLines(path, StandardCharsets.UTF_8)); 190 190 } catch (final FileNotFoundException e) { 191 191 Main.debug(Main.getErrorMessage(e)); … … 204 204 */ 205 205 public static void addIgnoredError(String s) { 206 IGNORED_ERRORS.add(s);206 ignoredErrors.add(s); 207 207 } 208 208 … … 213 213 */ 214 214 public static boolean hasIgnoredError(String s) { 215 return IGNORED_ERRORS.contains(s);215 return ignoredErrors.contains(s); 216 216 } 217 217 … … 221 221 public static void saveIgnoredErrors() { 222 222 try (PrintWriter out = new PrintWriter(new File(getValidatorDir(), "ignorederrors"), StandardCharsets.UTF_8.name())) { 223 for (String e : IGNORED_ERRORS) {223 for (String e : ignoredErrors) { 224 224 out.println(e); 225 225 } … … 254 254 */ 255 255 public static SortedMap<String, Test> getAllTestsMap() { 256 applyPrefs( ALL_TESTS_MAP, false);257 applyPrefs( ALL_TESTS_MAP, true);258 return new TreeMap<>( ALL_TESTS_MAP);256 applyPrefs(allTestsMap, false); 257 applyPrefs(allTestsMap, true); 258 return new TreeMap<>(allTestsMap); 259 259 } 260 260 … … 271 271 return null; 272 272 } 273 return (T) ALL_TESTS_MAP.get(testClass.getName());273 return (T) allTestsMap.get(testClass.getName()); 274 274 } 275 275 … … 318 318 */ 319 319 public static Collection<Class<? extends Test>> getAllAvailableTestClasses() { 320 return Collections.unmodifiableCollection( ALL_TESTS);320 return Collections.unmodifiableCollection(allTests); 321 321 } 322 322 -
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r12537 r12542 53 53 private static DefaultNameFormatter instance; 54 54 55 private static final List<NameFormatterHook> FORMAT_HOOKS= new LinkedList<>();55 private static final List<NameFormatterHook> formatHooks = new LinkedList<>(); 56 56 57 57 /** … … 75 75 public static void registerFormatHook(NameFormatterHook hook) { 76 76 if (hook == null) return; 77 if (! FORMAT_HOOKS.contains(hook)) {78 FORMAT_HOOKS.add(0, hook);77 if (!formatHooks.contains(hook)) { 78 formatHooks.add(0, hook); 79 79 } 80 80 } … … 87 87 public static void unregisterFormatHook(NameFormatterHook hook) { 88 88 if (hook == null) return; 89 if ( FORMAT_HOOKS.contains(hook)) {90 FORMAT_HOOKS.remove(hook);89 if (formatHooks.contains(hook)) { 90 formatHooks.remove(hook); 91 91 } 92 92 } … … 203 203 204 204 String result = name.toString(); 205 for (NameFormatterHook hook: FORMAT_HOOKS) {205 for (NameFormatterHook hook: formatHooks) { 206 206 String hookResult = hook.checkFormat(node, result); 207 207 if (hookResult != null) … … 295 295 296 296 String result = name.toString(); 297 for (NameFormatterHook hook: FORMAT_HOOKS) {297 for (NameFormatterHook hook: formatHooks) { 298 298 String hookResult = hook.checkFormat(way, result); 299 299 if (hookResult != null) … … 333 333 334 334 String result = name.toString(); 335 for (NameFormatterHook hook: FORMAT_HOOKS) {335 for (NameFormatterHook hook: formatHooks) { 336 336 String hookResult = hook.checkFormat(relation, result); 337 337 if (hookResult != null) … … 430 430 } 431 431 432 for (NameFormatterHook hook: FORMAT_HOOKS) {432 for (NameFormatterHook hook: formatHooks) { 433 433 String hookResult = hook.checkRelationTypeName(relation, name); 434 434 if (hookResult != null) -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r12537 r12542 75 75 76 76 /** list of custom components that can be added by plugins at JOSM startup */ 77 private static final Collection<Component> CUSTOM_COMPONENTS= new ArrayList<>();77 private static final Collection<Component> customComponents = new ArrayList<>(); 78 78 79 79 /** the "created_by" changeset OSM key */ … … 136 136 137 137 // Custom components 138 for (Component c : CUSTOM_COMPONENTS) {138 for (Component c : customComponents) { 139 139 pnl.add(c, GBC.eol().fill(GBC.HORIZONTAL)); 140 140 } … … 406 406 public static boolean addCustomComponent(Component c) { 407 407 if (c != null) { 408 return CUSTOM_COMPONENTS.add(c);408 return customComponents.add(c); 409 409 } 410 410 return false; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresets.java
r12537 r12542 31 31 32 32 /** The collection of tagging presets */ 33 private static final Collection<TaggingPreset> TAGGING_PRESETS= new ArrayList<>();33 private static final Collection<TaggingPreset> taggingPresets = new ArrayList<>(); 34 34 35 35 /** cache for key/value pairs found in the preset */ … … 39 39 40 40 /** The collection of listeners */ 41 private static final Collection<TaggingPresetListener> LISTENERS= new ArrayList<>();41 private static final Collection<TaggingPresetListener> listeners = new ArrayList<>(); 42 42 43 43 private TaggingPresets() { … … 49 49 */ 50 50 public static void readFromPreferences() { 51 TAGGING_PRESETS.clear();52 TAGGING_PRESETS.addAll(TaggingPresetReader.readFromPreferences(false, false));53 cachePresets( TAGGING_PRESETS);51 taggingPresets.clear(); 52 taggingPresets.addAll(TaggingPresetReader.readFromPreferences(false, false)); 53 cachePresets(taggingPresets); 54 54 } 55 55 … … 59 59 public static void initialize() { 60 60 readFromPreferences(); 61 for (TaggingPreset tp: TAGGING_PRESETS) {61 for (TaggingPreset tp: taggingPresets) { 62 62 if (!(tp instanceof TaggingPresetSeparator)) { 63 63 Main.toolbar.register(tp); 64 64 } 65 65 } 66 if ( TAGGING_PRESETS.isEmpty()) {66 if (taggingPresets.isEmpty()) { 67 67 Main.main.menu.presetsMenu.setVisible(false); 68 68 } else { 69 69 Map<TaggingPresetMenu, JMenu> submenus = new HashMap<>(); 70 for (final TaggingPreset p : TAGGING_PRESETS) {70 for (final TaggingPreset p : taggingPresets) { 71 71 JMenu m = p.group != null ? submenus.get(p.group) : Main.main.menu.presetsMenu; 72 72 if (m == null && p.group != null) { … … 136 136 */ 137 137 public static Collection<TaggingPreset> getTaggingPresets() { 138 return Collections.unmodifiableCollection( TAGGING_PRESETS);138 return Collections.unmodifiableCollection(taggingPresets); 139 139 } 140 140 … … 199 199 */ 200 200 public static void addTaggingPresets(Collection<TaggingPreset> presets) { 201 if (presets != null && TAGGING_PRESETS.addAll(presets)) {202 for (TaggingPresetListener listener : LISTENERS) {201 if (presets != null && taggingPresets.addAll(presets)) { 202 for (TaggingPresetListener listener : listeners) { 203 203 listener.taggingPresetsModified(); 204 204 } … … 212 212 public static void addListener(TaggingPresetListener listener) { 213 213 if (listener != null) { 214 LISTENERS.add(listener);214 listeners.add(listener); 215 215 } 216 216 } … … 222 222 public static void removeListener(TaggingPresetListener listener) { 223 223 if (listener != null) { 224 LISTENERS.remove(listener);224 listeners.remove(listener); 225 225 } 226 226 } -
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r12537 r12542 99 99 static final Pattern OUTPUT_FORMAT_STATEMENT = Pattern.compile(".*\\[out:([a-z]{3,})\\].*", Pattern.DOTALL); 100 100 101 static final Map<OverpassOutpoutFormat, Class<? extends AbstractReader>> OUTPUT_FORMAT_READERS= new ConcurrentHashMap<>();101 static final Map<OverpassOutpoutFormat, Class<? extends AbstractReader>> outputFormatReaders = new ConcurrentHashMap<>(); 102 102 103 103 final String overpassServer; … … 125 125 public static final Class<? extends AbstractReader> registerOverpassOutpoutFormatReader( 126 126 OverpassOutpoutFormat format, Class<? extends AbstractReader> readerClass) { 127 return OUTPUT_FORMAT_READERS.put(Objects.requireNonNull(format), Objects.requireNonNull(readerClass));127 return outputFormatReaders.put(Objects.requireNonNull(format), Objects.requireNonNull(readerClass)); 128 128 } 129 129 … … 232 232 Matcher m = OUTPUT_FORMAT_STATEMENT.matcher(overpassQuery); 233 233 if (m.matches()) { 234 Class<? extends AbstractReader> readerClass = OUTPUT_FORMAT_READERS.get(OverpassOutpoutFormat.from(m.group(1)));234 Class<? extends AbstractReader> readerClass = outputFormatReaders.get(OverpassOutpoutFormat.from(m.group(1))); 235 235 if (readerClass != null) { 236 236 try { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
r12537 r12542 51 51 52 52 private final String sender; 53 private static final Set<String> TRUSTED_SENDERS= new HashSet<>();53 private static final Set<String> trustedSenders = new HashSet<>(); 54 54 55 55 static final class PropertyTableModel extends DefaultTableModel { … … 227 227 tablePanel.add(propertyTable.getTableHeader(), GBC.eol().fill(GBC.HORIZONTAL)); 228 228 tablePanel.add(propertyTable, GBC.eol().fill(GBC.BOTH)); 229 if (!sender.isEmpty() && ! TRUSTED_SENDERS.contains(sender)) {229 if (!sender.isEmpty() && !trustedSenders.contains(sender)) { 230 230 final JCheckBox c = new JCheckBox(); 231 231 c.setAction(new AbstractAction(tr("Accept all tags from {0} for this session", sender)) { 232 232 @Override public void actionPerformed(ActionEvent e) { 233 233 if (c.isSelected()) 234 TRUSTED_SENDERS.add(sender);234 trustedSenders.add(sender); 235 235 else 236 TRUSTED_SENDERS.remove(sender);236 trustedSenders.remove(sender); 237 237 } 238 238 }); … … 263 263 } 264 264 if (buttonIndex == 2) { 265 TRUSTED_SENDERS.remove(sender);265 trustedSenders.remove(sender); 266 266 } 267 267 setVisible(false); … … 308 308 */ 309 309 public static void addTags(String[][] keyValue, String sender, Collection<? extends OsmPrimitive> primitives) { 310 if ( TRUSTED_SENDERS.contains(sender)) {310 if (trustedSenders.contains(sender)) { 311 311 if (Main.getLayerManager().getEditDataSet() != null) { 312 312 for (String[] row : keyValue) { -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r12537 r12542 147 147 } 148 148 149 private static final Map<String, Class<? extends SessionLayerImporter>> SESSION_LAYER_IMPORTERS= new HashMap<>();149 private static final Map<String, Class<? extends SessionLayerImporter>> sessionLayerImporters = new HashMap<>(); 150 150 151 151 private URI sessionFileURI; … … 174 174 */ 175 175 public static void registerSessionLayerImporter(String layerType, Class<? extends SessionLayerImporter> importer) { 176 SESSION_LAYER_IMPORTERS.put(layerType, importer);176 sessionLayerImporters.put(layerType, importer); 177 177 } 178 178 … … 183 183 */ 184 184 public static SessionLayerImporter getSessionLayerImporter(String layerType) { 185 Class<? extends SessionLayerImporter> importerClass = SESSION_LAYER_IMPORTERS.get(layerType);185 Class<? extends SessionLayerImporter> importerClass = sessionLayerImporters.get(layerType); 186 186 if (importerClass == null) 187 187 return null;
Note:
See TracChangeset
for help on using the changeset viewer.