Changeset 1034 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-10-09T09:34:33+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r1033 r1034 93 93 args.put(key, v); 94 94 } 95 96 // Only show the splash screen if we don't print the help and exit97 SplashScreen splash;98 if (!argList.contains("--help") && !argList.contains("-?") && !argList.contains("-h")) {99 splash = new SplashScreen();100 } else {101 splash = null;102 }103 104 splash.setStatus(tr("Reading preferences"));105 // get the preferences.106 final File prefDir = new File(Main.pref.getPreferencesDir());107 // check if preferences directory has moved (TODO: Update code. Remove this after some time)108 File oldPrefDir = new File(System.getProperty("user.home"), ".josm");109 if (!prefDir.isDirectory() && oldPrefDir.isDirectory()) {110 if (oldPrefDir.renameTo(prefDir)) {111 // do not translate this112 JOptionPane.showMessageDialog(null, "The preference directory has been moved to "+prefDir);113 } else {114 JOptionPane.showMessageDialog(null, "The preference directory location has changed. Please move "+oldPrefDir+" to "+prefDir);115 }116 }117 118 if (prefDir.exists() && !prefDir.isDirectory()) {119 JOptionPane.showMessageDialog(null, "Cannot open preferences directory: "+Main.pref.getPreferencesDir());120 return;121 }122 if (!prefDir.exists())123 prefDir.mkdirs();124 125 if (!new File(Main.pref.getPreferencesDir()+"preferences").exists()) {126 Main.pref.resetToDefault();127 }128 129 try {130 if (args.containsKey("reset-preferences")) {131 Main.pref.resetToDefault();132 } else {133 Main.pref.load();134 }135 } catch (final IOException e1) {136 e1.printStackTrace();137 String backup = Main.pref.getPreferencesDir() + "preferences.bak";138 JOptionPane.showMessageDialog(null, "Preferences file had errors. Making backup of old one to " + backup);139 new File(Main.pref.getPreferencesDir() + "preferences").renameTo(new File(backup));140 Main.pref.save();141 }142 String language = null;143 if(args.containsKey("language"))144 language = (String)(args.get("language").toArray()[0]);145 146 splash.setStatus(tr("Activating updated plugins"));147 if (!PluginDownloader.moveUpdatedPlugins()) {148 JOptionPane.showMessageDialog(null,149 tr("Activating the updated plugins failed. Check if JOSM has the permission to overwrite the existing ones."),150 tr("Plugins"), JOptionPane.ERROR_MESSAGE);151 }152 153 // load the early plugins154 splash.setStatus(tr("Loading early plugins"));155 Main.loadPlugins(true, language);156 95 157 96 if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) { … … 183 122 } 184 123 124 SplashScreen splash = new SplashScreen(); 125 splash.setStatus(tr("Reading preferences")); 126 // get the preferences. 127 final File prefDir = new File(Main.pref.getPreferencesDir()); 128 // check if preferences directory has moved (TODO: Update code. Remove this after some time) 129 File oldPrefDir = new File(System.getProperty("user.home"), ".josm"); 130 if (!prefDir.isDirectory() && oldPrefDir.isDirectory()) { 131 if (oldPrefDir.renameTo(prefDir)) { 132 // do not translate this 133 JOptionPane.showMessageDialog(null, "The preference directory has been moved to "+prefDir); 134 } else { 135 JOptionPane.showMessageDialog(null, "The preference directory location has changed. Please move "+oldPrefDir+" to "+prefDir); 136 } 137 } 138 139 if (prefDir.exists() && !prefDir.isDirectory()) { 140 JOptionPane.showMessageDialog(null, "Cannot open preferences directory: "+Main.pref.getPreferencesDir()); 141 return; 142 } 143 if (!prefDir.exists()) 144 prefDir.mkdirs(); 145 146 if (!new File(Main.pref.getPreferencesDir()+"preferences").exists()) { 147 Main.pref.resetToDefault(); 148 } 149 150 try { 151 if (args.containsKey("reset-preferences")) { 152 Main.pref.resetToDefault(); 153 } else { 154 Main.pref.load(); 155 } 156 } catch (final IOException e1) { 157 e1.printStackTrace(); 158 String backup = Main.pref.getPreferencesDir() + "preferences.bak"; 159 JOptionPane.showMessageDialog(null, "Preferences file had errors. Making backup of old one to " + backup); 160 new File(Main.pref.getPreferencesDir() + "preferences").renameTo(new File(backup)); 161 Main.pref.save(); 162 } 163 String language = null; 164 if(args.containsKey("language")) 165 language = (String)(args.get("language").toArray()[0]); 166 167 splash.setStatus(tr("Activating updated plugins")); 168 if (!PluginDownloader.moveUpdatedPlugins()) { 169 JOptionPane.showMessageDialog(null, 170 tr("Activating the updated plugins failed. Check if JOSM has the permission to overwrite the existing ones."), 171 tr("Plugins"), JOptionPane.ERROR_MESSAGE); 172 } 173 174 // load the early plugins 175 splash.setStatus(tr("Loading early plugins")); 176 Main.loadPlugins(true, language); 177 185 178 splash.setStatus(tr("Setting defaults")); 186 179 preConstructorInit(args);
Note:
See TracChangeset
for help on using the changeset viewer.