diff --git a/src/org/openstreetmap/josm/data/CustomConfigurator.java b/src/org/openstreetmap/josm/data/CustomConfigurator.java
index e845e2d..98f4488 100644
|
a
|
b
|
public class CustomConfigurator {
|
| 415 | 415 | |
| 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); |
| 428 | 434 | builderFactory.setNamespaceAware(true); |
diff --git a/src/org/openstreetmap/josm/gui/MainApplication.java b/src/org/openstreetmap/josm/gui/MainApplication.java
index 01676f4..1573010 100644
|
a
|
b
|
import java.awt.event.WindowEvent;
|
| 12 | 12 | import java.io.File; |
| 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; |
| 17 | 18 | import java.security.PermissionCollection; |
| … |
… |
import javax.swing.SwingUtilities;
|
| 30 | 31 | import org.jdesktop.swinghelper.debug.CheckThreadViolationRepaintManager; |
| 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; |
| 35 | 37 | import org.openstreetmap.josm.gui.download.DownloadDialog; |
| … |
… |
public class MainApplication extends Main {
|
| 102 | 104 | "\t--selection=<searchstring> "+tr("Select with the given search")+"\n"+ |
| 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"+ |
| 107 | 110 | tr("options provided as Java system properties")+":\n"+ |
| … |
… |
public class MainApplication extends Main {
|
| 201 | 204 | } |
| 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")) { |
| 206 | 225 | String[] kv = i.split("=", 2); |
| … |
… |
public class MainApplication extends Main {
|
| 247 | 266 | preConstructorInit(args); |
| 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); |
| 254 | 271 | |