- Timestamp:
- 2008-11-02T14:28:20+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1058 r1062 221 221 public static void loadPlugins(boolean early) { 222 222 List<String> plugins = new LinkedList<String>(); 223 if (Main.pref.hasKey("plugins")) 224 plugins.addAll(Arrays.asList(Main.pref.get("plugins").split(","))); 223 Collection<String> cp = Main.pref.getCollection("plugins", null); 224 if (cp != null) 225 plugins.addAll(cp); 225 226 if (System.getProperty("josm.plugins") != null) 226 227 plugins.addAll(Arrays.asList(System.getProperty("josm.plugins").split(","))); … … 232 233 { 233 234 plugins.remove(p); 235 Main.pref.removeFromCollection("plugins", p); 234 236 System.out.println(tr("Warning - loading of {0} plugin was requested. This plugin is no longer required.", p)); 235 237 } -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r1025 r1062 10 10 import java.io.PrintWriter; 11 11 import java.util.ArrayList; 12 import java.util.Arrays; 12 13 import java.util.Collection; 13 14 import java.util.LinkedList; … … 401 402 } 402 403 404 synchronized public Collection<String> getCollection(String key, Collection<String> def) { 405 String s = get(key); 406 if(s != null) 407 { 408 /* handle old comma separated stuff - remove in future */ 409 if(s.indexOf(',') >= 0) 410 return Arrays.asList(s.split(",")); 411 else 412 return Arrays.asList(s.split(";")); 413 } 414 else if(def != null) 415 return def; 416 return null; 417 } 418 synchronized public void removeFromCollection(String key, String value) { 419 ArrayList<String> a = new ArrayList<String>(getCollection(key, null)); 420 if(a != null) 421 { 422 a.remove(value); 423 putCollection(key, a); 424 } 425 } 426 synchronized public void putCollection(String key, Collection<String> val) { 427 String s = null; 428 if(val != null) 429 { 430 for(String a : val) 431 { 432 if(s != null) 433 s += ";" + a; 434 else 435 s = a; 436 } 437 } 438 439 put(key, s); 440 } 441 403 442 private void setSystemProperties() { 404 443 Properties sysProp = System.getProperties();
Note:
See TracChangeset
for help on using the changeset viewer.