Changeset 17679 in josm for trunk/src/org/openstreetmap/josm/gui/MainApplication.java
- Timestamp:
- 2021-03-28T14:58:23+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r17668 r17679 342 342 } 343 343 344 /** 345 * Asks user to update its version of Java. 346 * @param updVersion target update version 347 * @param url download URL 348 * @param major true for a migration towards a major version of Java (8:9), false otherwise 349 * @param eolDate the EOL/expiration date 350 * @since 12270 351 */ 352 public static void askUpdateJava(String updVersion, String url, String eolDate, boolean major) { 353 ExtendedDialog ed = new ExtendedDialog( 354 mainFrame, 355 tr("Outdated Java version"), 356 tr("OK"), tr("Update Java"), tr("Cancel")); 344 private static void askUpdate(String title, String update, String property, String icon, StringBuilder content, String url) { 345 ExtendedDialog ed = new ExtendedDialog(mainFrame, title, tr("OK"), update, tr("Cancel")); 357 346 // Check if the dialog has not already been permanently hidden by user 358 if (!ed.toggleEnable( "askUpdateJava"+updVersion).toggleCheckState()) {359 ed.setButtonIcons("ok", "java", "cancel").setCancelButton(3);347 if (!ed.toggleEnable(property).toggleCheckState()) { 348 ed.setButtonIcons("ok", icon, "cancel").setCancelButton(3); 360 349 ed.setMinimumSize(new Dimension(480, 300)); 361 350 ed.setIcon(JOptionPane.WARNING_MESSAGE); 362 StringBuilder content = new StringBuilder(tr("You are running version {0} of Java.",363 "<b>"+getSystemProperty("java.version")+"</b>")).append("<br><br>");364 if ("Sun Microsystems Inc.".equals(getSystemProperty("java.vendor")) && !PlatformManager.getPlatform().isOpenJDK()) {365 content.append("<b>").append(tr("This version is no longer supported by {0} since {1} and is not recommended for use.",366 "Oracle", eolDate)).append("</b><br><br>");367 }368 content.append("<b>")369 .append(major ?370 tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", updVersion) :371 tr("You may face critical Java bugs; we highly recommend you to update to Java {0}.", updVersion))372 .append("</b><br><br>")373 .append(tr("Would you like to update now ?"));374 351 ed.setContent(content.toString()); 375 352 … … 382 359 } 383 360 } 361 } 362 363 /** 364 * Asks user to update its version of Java. 365 * @param updVersion target update version 366 * @param url download URL 367 * @param major true for a migration towards a major version of Java (8:11), false otherwise 368 * @param eolDate the EOL/expiration date 369 * @since 12270 370 */ 371 public static void askUpdateJava(String updVersion, String url, String eolDate, boolean major) { 372 StringBuilder content = new StringBuilder(tr("You are running version {0} of Java.", 373 "<b>"+getSystemProperty("java.version")+"</b>")).append("<br><br>"); 374 if ("Sun Microsystems Inc.".equals(getSystemProperty("java.vendor")) && !PlatformManager.getPlatform().isOpenJDK()) { 375 content.append("<b>").append(tr("This version is no longer supported by {0} since {1} and is not recommended for use.", 376 "Oracle", eolDate)).append("</b><br><br>"); 377 } 378 content.append("<b>") 379 .append(major ? 380 tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", updVersion) : 381 tr("You may face critical Java bugs; we highly recommend you to update to Java {0}.", updVersion)) 382 .append("</b><br><br>") 383 .append(tr("Would you like to update now ?")); 384 askUpdate(tr("Outdated Java version"), tr("Update Java"), "askUpdateJava"+updVersion, "java", content, url); 385 } 386 387 /** 388 * Asks user to migrate to OpenWebStart 389 * @param url download URL 390 * @since 17679 391 */ 392 public static void askMigrateWebStart(String url) { 393 // CHECKSTYLE.OFF: LineLength 394 StringBuilder content = new StringBuilder(tr("You are running an <b>Oracle</b> implementation of Java WebStart.")) 395 .append("<br><br>") 396 .append(tr("It was for years the recommended way to use JOSM. Oracle removed WebStart from Java 11,<br>but the open source community reimplemented the Java Web Start technology as a new product: <b>OpenWebStart</b>")) 397 .append("<br><br>") 398 .append(tr("OpenWebStart is now considered mature enough by JOSM developers to ask everyone to move away from an Oracle implementation,<br>allowing you to benefit from a recent version of Java, and allowing JOSM developers to move forward by planning the Java {0} migration.", "11")) 399 .append("<br><br>") 400 .append(tr("Would you like to <b>download OpenWebStart now</b>? (Please do!)")); 401 askUpdate(tr("Outdated Java WebStart version"), tr("Update to OpenWebStart"), "askUpdateWebStart", "presets/transport/rocket", content, url); 402 // CHECKSTYLE.ON: LineLength 384 403 } 385 404
Note:
See TracChangeset
for help on using the changeset viewer.