Ignore:
Timestamp:
2017-09-05T21:35:24+02:00 (2 years ago)
Author:
Don-vip
Message:

see #15229 - see #15182 - remove GUI dependence of PlatformHookWindows - move workaround to MainApplication

File:
1 edited

Legend:

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

    r12670 r12744  
    6666
    6767import javax.swing.JOptionPane;
    68 import javax.swing.UIManager;
    6968
    7069import org.openstreetmap.josm.Main;
    7170import org.openstreetmap.josm.data.Preferences;
    72 import org.openstreetmap.josm.gui.preferences.display.LafPreference;
    7371import org.openstreetmap.josm.io.CertificateAmendment.CertAmend;
    7472
     
    161159    public void afterPrefStartupHook() {
    162160        extendFontconfig("fontconfig.properties.src");
    163         // Workaround for JDK-8180379: crash on Windows 10 1703 with Windows L&F and java < 8u152 / 9+171
    164         // To remove during Java 9 migration
    165         if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows 10") &&
    166                 getDefaultStyle().equals(LafPreference.LAF.get())) {
    167             try {
    168                 final int currentBuild = Integer.parseInt(getCurrentBuild());
    169                 final int javaVersion = Utils.getJavaVersion();
    170                 final int javaUpdate = Utils.getJavaUpdate();
    171                 final int javaBuild = Utils.getJavaBuild();
    172                 // See https://technet.microsoft.com/en-us/windows/release-info.aspx
    173                 if (currentBuild >= 15_063 && ((javaVersion == 8 && javaUpdate < 141)
    174                         || (javaVersion == 9 && javaUpdate == 0 && javaBuild < 173))) {
    175                     // Workaround from https://bugs.openjdk.java.net/browse/JDK-8179014
    176                     UIManager.put("FileChooser.useSystemExtensionHiding", Boolean.FALSE);
    177                 }
    178             } catch (NumberFormatException | ReflectiveOperationException e) {
    179                 Logging.error(e);
    180             }
    181         }
    182161    }
    183162
     
    282261    }
    283262
    284     private static String getProductName() throws IllegalAccessException, InvocationTargetException {
     263    /**
     264     * Returns the Windows product name from registry (example: "Windows 10 Pro")
     265     * @return the Windows product name from registry
     266     * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
     267     * @throws InvocationTargetException if the underlying method throws an exception
     268     * @since 12744
     269     */
     270    public static String getProductName() throws IllegalAccessException, InvocationTargetException {
    285271        return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "ProductName");
    286272    }
    287273
    288     private static String getReleaseId() throws IllegalAccessException, InvocationTargetException {
     274    /**
     275     * Returns the Windows release identifier from registry (example: "1703")
     276     * @return the Windows release identifier from registry
     277     * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
     278     * @throws InvocationTargetException if the underlying method throws an exception
     279     * @since 12744
     280     */
     281    public static String getReleaseId() throws IllegalAccessException, InvocationTargetException {
    289282        return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "ReleaseId");
    290283    }
    291284
    292     private static String getCurrentBuild() throws IllegalAccessException, InvocationTargetException {
     285    /**
     286     * Returns the Windows current build number from registry (example: "15063")
     287     * @return the Windows current build number from registry
     288     * @throws IllegalAccessException if Java language access control is enforced and the underlying method is inaccessible
     289     * @throws InvocationTargetException if the underlying method throws an exception
     290     * @since 12744
     291     */
     292    public static String getCurrentBuild() throws IllegalAccessException, InvocationTargetException {
    293293        return WinRegistry.readString(HKEY_LOCAL_MACHINE, CURRENT_VERSION, "CurrentBuild");
    294294    }
Note: See TracChangeset for help on using the changeset viewer.