- Timestamp:
- 2017-01-25T14:12:07+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r11386 r11493 463 463 464 464 /** 465 * remove a style source; only accessed from MapPaintStyles 466 * @param style style source to remove 467 * @return {@code true} if this list contained the specified element 468 */ 469 boolean remove(StyleSource style) { 470 return styleSources.remove(style); 471 } 472 473 /** 465 474 * set the style sources; only accessed from MapPaintStyles 466 475 * @param sources new style sources -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r11401 r11493 290 290 291 291 private static StyleSource fromSourceEntry(SourceEntry entry) { 292 if (entry.url == null && entry instanceof MapCSSStyleSource) { 293 return (MapCSSStyleSource) entry; 294 } 292 295 Set<String> mimes = new HashSet<>(Arrays.asList(MapCSSStyleSource.MAPCSS_STYLE_MIME_TYPES.split(", "))); 293 296 try (CachedFile cf = new CachedFile(entry.url).setHttpAccept(Utils.join(", ", mimes))) { … … 419 422 styles.add(source); 420 423 loadStyleForFirstTime(source); 424 refreshStyles(); 425 return source; 426 } 427 428 /** 429 * Remove a map paint style. 430 * @param entry map paint style 431 * @since 11493 432 */ 433 public static void removeStyle(SourceEntry entry) { 434 StyleSource source = fromSourceEntry(entry); 435 if (styles.remove(source)) { 436 refreshStyles(); 437 } 438 } 439 440 private static void refreshStyles() { 421 441 MapPaintPrefHelper.INSTANCE.put(styles.getStyleSources()); 422 442 fireMapPaintSylesUpdated(); … … 425 445 Main.map.mapView.repaint(); 426 446 } 427 return source;428 447 } 429 448 -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r10611 r11493 272 272 public Map<String, String> serialize(SourceEntry entry) { 273 273 Map<String, String> res = new HashMap<>(); 274 res.put("url", entry.url); 274 res.put("url", entry.url == null ? "" : entry.url); 275 275 res.put("title", entry.title == null ? "" : entry.title); 276 276 res.put("active", Boolean.toString(entry.active)); -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r11386 r11493 207 207 File file = getFile(); 208 208 if (file == null) { 209 if (name.startsWith("resource://")) { 209 if (name != null && name.startsWith("resource://")) { 210 210 InputStream is = getClass().getResourceAsStream( 211 211 name.substring("resource:/".length())); … … 273 273 } 274 274 } catch (MalformedURLException e) { 275 if (name.startsWith("resource://")) { 275 if (name == null || name.startsWith("resource://")) { 276 276 return null; 277 277 } else if (name.startsWith("josmdir://")) { -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r11435 r11493 1166 1166 */ 1167 1167 public static boolean isLocalUrl(String url) { 1168 if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("resource://")) 1168 if (url == null || url.startsWith("http://") || url.startsWith("https://") || url.startsWith("resource://")) 1169 1169 return false; 1170 1170 return true;
Note:
See TracChangeset
for help on using the changeset viewer.