Changeset 5201 in josm
- Timestamp:
- 2012-04-21T09:25:21+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r5162 r5201 416 416 417 417 ScriptEngine engine ; 418 418 419 419 public void openAndReadXML(File file) { 420 420 log("-- Reading custom preferences from " + file.getAbsolutePath() + " --"); 421 InputStream is = null;422 421 try { 423 is = new BufferedInputStream(new FileInputStream(file));424 422 String fileDir = file.getParentFile().getAbsolutePath(); 425 423 if (fileDir!=null) engine.eval("scriptDir='"+normalizeDirName(fileDir) +"';"); 424 openAndReadXML(new BufferedInputStream(new FileInputStream(file))); 425 } catch (Exception ex) { 426 log("Error reading custom preferences: " + ex.getMessage()); 427 } 428 } 429 430 public void openAndReadXML(InputStream is) { 431 try { 426 432 DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); 427 433 builderFactory.setValidating(false); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r4932 r5201 13 13 import java.net.Authenticator; 14 14 import java.net.ProxySelector; 15 import java.net.URL; 15 16 import java.security.AllPermission; 16 17 import java.security.CodeSource; … … 31 32 import org.openstreetmap.josm.Main; 32 33 import org.openstreetmap.josm.data.AutosaveTask; 34 import org.openstreetmap.josm.data.CustomConfigurator; 33 35 import org.openstreetmap.josm.data.Preferences; 34 36 import org.openstreetmap.josm.data.Version; … … 103 105 "\t--[no-]maximize "+tr("Launch in maximized mode")+"\n"+ 104 106 "\t--reset-preferences "+tr("Reset the preferences to default")+"\n\n"+ 107 "\t--load-preferences=<url-to-xml> "+tr("Changes preferences according to the XML file")+"\n\n"+ 105 108 "\t--set=<key>=<value> "+tr("Set preference key to value")+"\n\n"+ 106 109 "\t--language=<language> "+tr("Set the language")+"\n\n"+ … … 202 205 Main.pref.updateSystemProperties(); 203 206 207 JFrame mainFrame = new JFrame(tr("Java OpenStreetMap Editor")); 208 Main.parent = mainFrame; 209 210 if (args.containsKey("load-preferences")) { 211 CustomConfigurator.XMLCommandProcessor config = new CustomConfigurator.XMLCommandProcessor(Main.pref); 212 for (String i : args.get("load-preferences")) { 213 System.out.println("Reading preferences from " + i); 214 try { 215 URL url = new URL(i); 216 config.openAndReadXML(url.openStream()); 217 } catch (Exception ex) { 218 throw new RuntimeException(ex); 219 } 220 } 221 } 222 204 223 if (args.containsKey("set")) { 205 224 for (String i : args.get("set")) { … … 248 267 249 268 monitor.indeterminateSubTask(tr("Creating main GUI")); 250 JFrame mainFrame = new JFrame(tr("Java OpenStreetMap Editor"));251 Main.parent = mainFrame;252 269 Main.addListener(); 253 270 final Main main = new MainApplication(mainFrame);
Note:
See TracChangeset
for help on using the changeset viewer.