diff --git a/src/org/openstreetmap/josm/data/CustomConfigurator.java b/src/org/openstreetmap/josm/data/CustomConfigurator.java
index 5aa8449..d853b28 100644
a
|
b
|
public class CustomConfigurator {
|
415 | 415 | |
416 | 416 | |
417 | 417 | ScriptEngine engine ; |
418 | | |
| 418 | |
419 | 419 | public void openAndReadXML(File file) { |
420 | | log("-- Reading custom preferences from " + file.getAbsolutePath() + " --"); |
421 | | InputStream is = null; |
422 | 420 | try { |
423 | | is = new BufferedInputStream(new FileInputStream(file)); |
| 421 | log("-- Reading custom preferences from " + file.getAbsolutePath() + " --"); |
| 422 | openAndReadXML(new BufferedInputStream(new FileInputStream(file))); |
| 423 | log("-- Reading complete --"); |
| 424 | } catch (IOException ex) { |
| 425 | log("Error reading custom preferences: " + ex.getMessage()); |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | public void openAndReadXML(InputStream is) { |
| 430 | try { |
424 | 431 | DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); |
425 | 432 | builderFactory.setValidating(false); |
426 | 433 | builderFactory.setNamespaceAware(true); |
… |
… |
public class CustomConfigurator {
|
438 | 445 | } |
439 | 446 | } catch (IOException ex) { } |
440 | 447 | } |
441 | | log("-- Reading complete --"); |
442 | 448 | } |
443 | 449 | |
444 | 450 | public XMLCommandProcessor(Preferences mainPrefs) { |
diff --git a/src/org/openstreetmap/josm/gui/MainApplication.java b/src/org/openstreetmap/josm/gui/MainApplication.java
index 01676f4..d108c83 100644
a
|
b
|
import java.awt.event.ActionEvent;
|
10 | 10 | import java.awt.event.WindowAdapter; |
11 | 11 | import java.awt.event.WindowEvent; |
12 | 12 | import java.io.File; |
13 | | import java.net.Authenticator; |
14 | | import java.net.ProxySelector; |
| 13 | import java.net.*; |
15 | 14 | import java.security.AllPermission; |
16 | 15 | import java.security.CodeSource; |
17 | 16 | import java.security.PermissionCollection; |
… |
… |
import javax.swing.SwingUtilities;
|
30 | 29 | import org.jdesktop.swinghelper.debug.CheckThreadViolationRepaintManager; |
31 | 30 | import org.openstreetmap.josm.Main; |
32 | 31 | import org.openstreetmap.josm.data.AutosaveTask; |
| 32 | import org.openstreetmap.josm.data.CustomConfigurator; |
33 | 33 | import org.openstreetmap.josm.data.Preferences; |
34 | 34 | import org.openstreetmap.josm.data.Version; |
35 | 35 | import org.openstreetmap.josm.gui.download.DownloadDialog; |
… |
… |
public class MainApplication extends Main {
|
102 | 102 | "\t--selection=<searchstring> "+tr("Select with the given search")+"\n"+ |
103 | 103 | "\t--[no-]maximize "+tr("Launch in maximized mode")+"\n"+ |
104 | 104 | "\t--reset-preferences "+tr("Reset the preferences to default")+"\n\n"+ |
| 105 | "\t--load-preferences=<url-to-xml> "+tr("Reset the preferences to default")+"\n\n"+ |
105 | 106 | "\t--set=<key>=<value> "+tr("Set preference key to value")+"\n\n"+ |
106 | 107 | "\t--language=<language> "+tr("Set the language")+"\n\n"+ |
107 | 108 | tr("options provided as Java system properties")+":\n"+ |
… |
… |
public class MainApplication extends Main {
|
201 | 202 | } |
202 | 203 | Main.pref.updateSystemProperties(); |
203 | 204 | |
| 205 | JFrame mainFrame = new JFrame(tr("Java OpenStreetMap Editor")); |
| 206 | Main.parent = mainFrame; |
| 207 | if (args.containsKey("load-preferences")) { |
| 208 | CustomConfigurator.XMLCommandProcessor config = new CustomConfigurator.XMLCommandProcessor(Main.pref); |
| 209 | for (String i : args.get("load-preferences")) { |
| 210 | System.out.println("Reading preferences from " + i); |
| 211 | try { |
| 212 | URL url = new URL(i); |
| 213 | config.openAndReadXML(url.openStream()); |
| 214 | } catch (Exception ex) { |
| 215 | throw new RuntimeException(ex); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
204 | 220 | if (args.containsKey("set")) { |
205 | 221 | for (String i : args.get("set")) { |
206 | 222 | String[] kv = i.split("=", 2); |
… |
… |
public class MainApplication extends Main {
|
247 | 263 | preConstructorInit(args); |
248 | 264 | |
249 | 265 | monitor.indeterminateSubTask(tr("Creating main GUI")); |
250 | | JFrame mainFrame = new JFrame(tr("Java OpenStreetMap Editor")); |
251 | | Main.parent = mainFrame; |
252 | 266 | Main.addListener(); |
253 | 267 | final Main main = new MainApplication(mainFrame); |
254 | 268 | |