Changeset 18790 in josm
- Timestamp:
- 2023-08-07T15:31:04+02:00 (16 months ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r18368 r18790 78 78 import org.openstreetmap.josm.tools.ImageProvider; 79 79 import org.openstreetmap.josm.tools.Logging; 80 import org.openstreetmap.josm.tools.OpenBrowser; 81 import org.openstreetmap.josm.tools.PlatformManager; 80 82 import org.openstreetmap.josm.tools.ResourceProvider; 81 83 import org.openstreetmap.josm.tools.SubclassFilteredCollection; … … 646 648 } 647 649 648 private static void logJavaUpdateRequired(String plugin, int requiredVersion) { 649 Logging.warn( 650 tr("Plugin {0} requires Java version {1}. The current Java version is {2}. " 651 +"You have to update Java in order to use this plugin.", 650 private static void alertJavaUpdateRequired(Component parent, String plugin, int requiredVersion) { 651 final ButtonSpec[] options = new ButtonSpec[] { 652 new ButtonSpec(tr("OK"), ImageProvider.get("ok"), tr("Click to close the dialog"), null), 653 new ButtonSpec(tr("Update Java"), ImageProvider.get("java"), tr("Update Java"), null) 654 }; 655 final int selected = HelpAwareOptionPane.showOptionDialog( 656 parent, 657 "<html>" + tr("Plugin {0} requires Java version {1}. The current Java version is {2}.<br>" 658 + "You have to update Java in order to use this plugin.", 652 659 plugin, Integer.toString(requiredVersion), Utils.getJavaVersion() 653 )); 660 ) + "</html>", 661 tr("Warning"), 662 JOptionPane.WARNING_MESSAGE, 663 null, 664 options, 665 options[0], 666 null 667 ); 668 if (selected == 1) { 669 if (Utils.isRunningJavaWebStart()) { 670 OpenBrowser.displayUrl(Config.getPref().get("openwebstart.download.url", "https://openwebstart.com/download/")); 671 } else if (!Utils.isRunningWebStart()) { 672 final String javaUrl = PlatformManager.getPlatform().getJavaUrl(); 673 OpenBrowser.displayUrl(javaUrl); 674 } 675 } 654 676 } 655 677 … … 663 685 tr("Warning"), 664 686 JOptionPane.WARNING_MESSAGE, 665 ht("/Plugin/Loading#JOSMUpdateRequired")687 null 666 688 ); 667 689 } … … 688 710 // make sure the plugin is compatible with the current Java version 689 711 if (plugin.localminjavaversion > Utils.getJavaVersion()) { 690 // Just log a warning until we switch to Java 11 so that javafx plugin does not trigger a popup 691 logJavaUpdateRequired(plugin.name, plugin.localminjavaversion); 712 alertJavaUpdateRequired(parent, plugin.name, plugin.localminjavaversion); 692 713 return false; 693 714 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHook.java
r18580 r18790 313 313 */ 314 314 default void warnSoonToBeUnsupportedJava(JavaExpirationCallback callback) { 315 // Java 11 is our next minimum version, and OpenWebStart should be replacing Oracle WebStart 316 // We'd go to 17, but some Linux distributions (Debian) default to Java 11. 317 // And OpenWebStart currently doesn't have Java 17 JREs. 318 if (Utils.getJavaVersion() < 11 && !Utils.isRunningWebStart()) { 315 // Java 17 is our next minimum version, and OpenWebStart should be replacing Oracle WebStart 316 if (Utils.getJavaVersion() < 17 && !Utils.isRunningWebStart()) { 319 317 String latestVersion = Utils.getJavaLatestVersion(); 320 318 String currentVersion = Utils.getSystemProperty("java.version"); … … 334 332 */ 335 333 default String getJavaUrl() { 336 StringBuilder defaultDownloadUrl = new StringBuilder("https://www.azul.com/downloads/?version=java-17-lts &package=jre-fx");334 StringBuilder defaultDownloadUrl = new StringBuilder("https://www.azul.com/downloads/?version=java-17-lts"); 337 335 if (PlatformManager.isPlatformWindows()) { 338 336 defaultDownloadUrl.append("&os=windows"); … … 348 346 if ("x86_64".equals(osArch) || "amd64".equals(osArch) 349 347 || "AMD64".equalsIgnoreCase(System.getenv("PROCESSOR_ARCHITEW6432"))) { 350 defaultDownloadUrl.append("&architecture=x86-64-bit") ;348 defaultDownloadUrl.append("&architecture=x86-64-bit").append("&package=jdk-fx"); // jdk-fx has an installer 351 349 } else if ("aarch64".equals(osArch)) { 352 defaultDownloadUrl.append("&architecture=arm-64-bit") ;350 defaultDownloadUrl.append("&architecture=arm-64-bit").append("&package=jdk-fx"); // jdk-fx has an installer 353 351 } else if ("x86".equals(osArch)) { 354 352 // Honestly, just about everyone should be on x86_64 at this point. But just in case someone 355 353 // is running JOSM on a 10-year-old computer. They'd probably be better off running a RPi. 356 defaultDownloadUrl.append("&architecture=x86-32-bit") ;354 defaultDownloadUrl.append("&architecture=x86-32-bit").append("&package=jdk"); // jdk has an installer 357 355 } // else user will have to figure it out themselves. 358 356 } 359 defaultDownloadUrl.append("# download-openjdk"); // Scrolls to download section357 defaultDownloadUrl.append("#zulu"); // Scrolls to download section 360 358 return defaultDownloadUrl.toString(); 361 359 }
Note:
See TracChangeset
for help on using the changeset viewer.