Changeset 12744 in josm


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

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

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/UserIdentityManager.java

    r12743 r12744  
    5050 *   <li>safely search for objects last touched by the current user based on its user id, not on its user name</li>
    5151 * </ul>
    52  * @since xxx (renamed from {@code org.openstreetmap.josm.gui.JosmUserIdentityManager})
     52 * @since 12743 (renamed from {@code org.openstreetmap.josm.gui.JosmUserIdentityManager})
    5353 * @since 2689 (creation)
    5454 */
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12726 r12744  
    812812        Main.platform.afterPrefStartupHook();
    813813
     814        applyWorkarounds();
     815
    814816        FontsManager.initialize();
    815817
     
    934936            Logging.info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
    935937            RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
     938        }
     939    }
     940
     941    static void applyWorkarounds() {
     942        // Workaround for JDK-8180379: crash on Windows 10 1703 with Windows L&F and java < 8u141 / 9+172
     943        // To remove during Java 9 migration
     944        if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows 10") &&
     945                platform.getDefaultStyle().equals(LafPreference.LAF.get())) {
     946            try {
     947                final int currentBuild = Integer.parseInt(PlatformHookWindows.getCurrentBuild());
     948                final int javaVersion = Utils.getJavaVersion();
     949                final int javaUpdate = Utils.getJavaUpdate();
     950                final int javaBuild = Utils.getJavaBuild();
     951                // See https://technet.microsoft.com/en-us/windows/release-info.aspx
     952                if (currentBuild >= 15_063 && ((javaVersion == 8 && javaUpdate < 141)
     953                        || (javaVersion == 9 && javaUpdate == 0 && javaBuild < 173))) {
     954                    // Workaround from https://bugs.openjdk.java.net/browse/JDK-8179014
     955                    UIManager.put("FileChooser.useSystemExtensionHiding", Boolean.FALSE);
     956                }
     957            } catch (NumberFormatException | ReflectiveOperationException e) {
     958                Logging.error(e);
     959            }
    936960        }
    937961    }
  • 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.