Changeset 7434 in josm for trunk/src/org/openstreetmap/josm/gui/MainApplication.java
- Timestamp:
- 2014-08-20T03:07:15+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r7383 r7434 27 27 import java.security.cert.CertificateException; 28 28 import java.util.ArrayList; 29 import java.util.Arrays; 29 30 import java.util.Collection; 30 31 import java.util.HashMap; … … 54 55 import org.openstreetmap.josm.io.DefaultProxySelector; 55 56 import org.openstreetmap.josm.io.MessageNotifier; 57 import org.openstreetmap.josm.io.OnlineResource; 56 58 import org.openstreetmap.josm.io.auth.CredentialsManager; 57 59 import org.openstreetmap.josm.io.auth.DefaultAuthenticator; … … 87 89 mainFrame.setJMenuBar(menu); 88 90 geometry.applySafe(mainFrame); 89 Li nkedList<Image> l = new LinkedList<>();91 List<Image> l = new LinkedList<>(); 90 92 l.add(ImageProvider.get("logo_16x16x32").getImage()); 91 93 l.add(ImageProvider.get("logo_16x16x8").getImage()); … … 131 133 "\t--version "+tr("Displays the JOSM version and exits")+"\n\n"+ 132 134 "\t--debug "+tr("Print debugging messages to console")+"\n\n"+ 135 "\t--offline=<osm_api|josm_website|all> "+tr("Disable access to the given resource(s), separated by comma")+"\n\n"+ 133 136 tr("options provided as Java system properties")+":\n"+ 134 137 "\t-Djosm.home="+tr("/PATH/TO/JOSM/FOLDER/ ")+tr("Change the folder for all user settings")+"\n\n"+ … … 154 157 */ 155 158 public enum Option { 156 /** --help|-h Show this help */159 /** --help|-h Show this help */ 157 160 HELP(false), 158 /** --version Displays the JOSM version and exits */161 /** --version Displays the JOSM version and exits */ 159 162 VERSION(false), 160 /** --debug Print debugging messages to console */163 /** --debug Print debugging messages to console */ 161 164 DEBUG(false), 162 /** --trace Print detailed debugging messages to console */165 /** --trace Print detailed debugging messages to console */ 163 166 TRACE(false), 164 /** --language=<language> Set the language */167 /** --language=<language> Set the language */ 165 168 LANGUAGE(true), 166 /** --reset-preferences Reset the preferences to default */169 /** --reset-preferences Reset the preferences to default */ 167 170 RESET_PREFERENCES(false), 168 /** --load-preferences=<url-to-xml> Changes preferences according to the XML file */171 /** --load-preferences=<url-to-xml> Changes preferences according to the XML file */ 169 172 LOAD_PREFERENCES(true), 170 /** --set=<key>=<value> Set preference key to value */173 /** --set=<key>=<value> Set preference key to value */ 171 174 SET(true), 172 /** --geometry=widthxheight(+|-)x(+|-)y Standard unix geometry argument */175 /** --geometry=widthxheight(+|-)x(+|-)y Standard unix geometry argument */ 173 176 GEOMETRY(true), 174 /** --no-maximize Do not launch in maximized mode */177 /** --no-maximize Do not launch in maximized mode */ 175 178 NO_MAXIMIZE(false), 176 /** --maximize Launch in maximized mode */179 /** --maximize Launch in maximized mode */ 177 180 MAXIMIZE(false), 178 /** --download=minlat,minlon,maxlat,maxlon Download the bounding box <br>179 * --download=<URL> Download the location at the URL (with lat=x&lon=y&zoom=z) <br>180 * --download=<filename> Open a file (any file type that can be opened with File/Open) */181 /** --download=minlat,minlon,maxlat,maxlon Download the bounding box <br> 182 * --download=<URL> Download the location at the URL (with lat=x&lon=y&zoom=z) <br> 183 * --download=<filename> Open a file (any file type that can be opened with File/Open) */ 181 184 DOWNLOAD(true), 182 /** --downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw GPS <br>183 * --downloadgps=<URL> Download the location at the URL (with lat=x&lon=y&zoom=z) as raw GPS */185 /** --downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw GPS <br> 186 * --downloadgps=<URL> Download the location at the URL (with lat=x&lon=y&zoom=z) as raw GPS */ 184 187 DOWNLOADGPS(true), 185 /** --selection=<searchstring> Select with the given search */ 186 SELECTION(true); 188 /** --selection=<searchstring> Select with the given search */ 189 SELECTION(true), 190 /** --offline=<osm_api|josm_website|all> Disable access to the given resource(s), delimited by comma */ 191 OFFLINE(true); 187 192 188 193 private String name; … … 284 289 } catch (IllegalArgumentException e) { 285 290 System.exit(1); 291 return; 286 292 } 287 293 … … 347 353 Main.pref.updateSystemProperties(); 348 354 355 processOffline(args); 356 349 357 FontsManager.initialize(); 350 358 351 359 final JFrame mainFrame = new JFrame(tr("Java OpenStreetMap Editor")); 352 360 Main.parent = mainFrame; … … 466 474 info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console"); 467 475 RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager()); 476 } 477 } 478 479 private static void processOffline(Map<Option, Collection<String>> args) { 480 if (args.containsKey(Option.OFFLINE)) { 481 for (String s : args.get(Option.OFFLINE).iterator().next().split(",")) { 482 try { 483 Main.setOffline(OnlineResource.valueOf(s.toUpperCase())); 484 } catch (IllegalArgumentException e) { 485 Main.error(tr("''{0}'' is not a valid value for argument ''{1}''. Possible values are {2}, possibly delimited by commas.", 486 s.toUpperCase(), Option.OFFLINE.getName(), Arrays.toString(OnlineResource.values()))); 487 System.exit(1); 488 return; 489 } 490 } 491 Set<OnlineResource> offline = Main.getOfflineResources(); 492 if (!offline.isEmpty()) { 493 Main.warn(trn("JOSM is running in offline mode. This resource will not be available: {0}", 494 "JOSM is running in offline mode. These resources will not be available: {0}", 495 offline.size(), offline.size() == 1 ? offline.iterator().next() : Arrays.toString(offline.toArray()))); 496 } 468 497 } 469 498 }
Note:
See TracChangeset
for help on using the changeset viewer.