Changeset 6943 in josm for trunk/src


Ignore:
Timestamp:
2014-03-29T15:24:48+01:00 (6 years ago)
Author:
Don-vip
Message:

see #8465 - Ask Mac/Debian/Ubuntu users to update their Java 6 version to Java 7

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r6851 r6943  
    4747            // We'll just ignore this for now. The user will still be able to close JOSM by closing all its windows.
    4848            Main.warn("Failed to register with OSX: " + ex);
     49        }
     50        // Invite users to install Java 7 if they are still with Java 6 and using a compatible OS X version (>= 10.7.3)
     51        String java = System.getProperty("java.version");
     52        String os = System.getProperty("os.version");
     53        if (java != null && java.startsWith("1.6") && os != null && (
     54                os.startsWith("10.7.") || os.startsWith("10.8") || os.startsWith("10.9"))) {
     55            askUpdateJava(java);
    4956        }
    5057    }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r6920 r6943  
    4040    @Override
    4141    public void startupHook() {
     42        if (isDebianOrUbuntu()) {
     43            // Invite users to install Java 7 if they are still with Java 6 and using a compatible distrib (Debian >= 7 or Ubuntu >= 12.04)
     44            String java = System.getProperty("java.version");
     45            String os = getOSDescription();
     46            if (java != null && java.startsWith("1.6") && os != null && (
     47                    os.startsWith("Linux Debian GNU/Linux 7") ||
     48                    os.startsWith("Linux Ubuntu 12") || os.startsWith("Linux Ubuntu 13") || os.startsWith("Linux Ubuntu 14"))) {
     49                askUpdateJava(java, "apt://openjdk-7-jre");
     50            }
     51        }
    4252    }
    4353
     
    325335
    326336    protected void askUpdateJava(String version) {
     337        askUpdateJava(version, "https://www.java.com/download");
     338    }
     339
     340    protected void askUpdateJava(String version, String url) {
    327341        try {
    328342            ExtendedDialog ed = new ExtendedDialog(
     
    333347            if (!ed.toggleEnable("askUpdateJava7").toggleCheckState()) {
    334348                ed.setButtonIcons(new String[]{"java.png", "cancel.png"}).setCancelButton(2);
    335                 ed.setMinimumSize(new Dimension(460, 260));
     349                ed.setMinimumSize(new Dimension(480, 300));
    336350                ed.setIcon(JOptionPane.WARNING_MESSAGE);
    337                 ed.setContent(tr("You are running version {0} of Java.", "<b>"+version+"</b>")+"<br><br>"+
    338                         "<b>"+tr("This version is no longer supported by {0} since {1} and is not recommended for use.", "Oracle", tr("February 2013"))+"</b><br><br>"+
    339                         "<b>"+tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", "7")+"</b><br><br>"+
    340                         tr("Would you like to update now ?"));
     351                String content = tr("You are running version {0} of Java.", "<b>"+version+"</b>")+"<br><br>";
     352                if ("Sun Microsystems Inc.".equals(System.getProperty("java.vendor"))) {
     353                    content += "<b>"+tr("This version is no longer supported by {0} since {1} and is not recommended for use.",
     354                            "Oracle", tr("February 2013"))+"</b><br><br>";
     355                }
     356                content += "<b>"+tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", "7")+"</b><br><br>"+
     357                        tr("Would you like to update now ?");
     358                ed.setContent(content);
    341359
    342360                if (ed.showDialog().getValue() == 1) {
    343                     openUrl("https://www.java.com/download");
     361                    openUrl(url);
    344362                }
    345363            }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r6443 r6943  
    3939    @Override
    4040    public void startupHook() {
    41         super.startupHook();
    42         // Invite users to install Oracle Java 7 if they are still with Sun/Oracle Java 6
    43         String vendor = System.getProperty("java.vendor");
     41        // Invite users to install Java 7 if they are still with Java 6
    4442        String version = System.getProperty("java.version");
    45         if ("Sun Microsystems Inc.".equals(vendor) && version != null && version.startsWith("1.6")) {
     43        if (version != null && version.startsWith("1.6")) {
    4644            askUpdateJava(version);
    4745        }
Note: See TracChangeset for help on using the changeset viewer.