Changeset 12268 in josm
- Timestamp:
- 2017-05-28T19:24:09+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r12262 r12268 144 144 <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/> 145 145 <!-- Java 9 stuff. Entries are safely ignored by Java 8 --> 146 <attribute name="Add-Exports" value="java.base/sun.security.util java.desktop/com. sun.imageio.spi jdk.deploy/com.sun.deploy.config" />146 <attribute name="Add-Exports" value="java.base/sun.security.util java.desktop/com.apple.eawt java.desktop/com.sun.imageio.spi jdk.deploy/com.sun.deploy.config" /> 147 147 <attribute name="Add-Opens" value="java.base/java.lang java.base/jdk.internal.loader java.base/sun.security.x509 java.desktop/javax.imageio.spi java.desktop/javax.swing.text.html java.prefs/java.util.prefs" /> 148 148 </manifest> -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r12219 r12268 60 60 Object proxy = Proxy.newProxyInstance(PlatformHookOsx.class.getClassLoader(), new Class<?>[] { 61 61 quitHandler, aboutHandler, openFilesHandler, preferencesHandler}, ivhandler); 62 try { 63 Object appli = eawtApplication.getConstructor((Class[]) null).newInstance((Object[]) null); 62 Object appli = eawtApplication.getConstructor((Class[]) null).newInstance((Object[]) null); 63 if (Utils.getJavaVersion() >= 9) { 64 setHandlers(Desktop.class, quitHandler, aboutHandler, openFilesHandler, preferencesHandler, proxy, Desktop.getDesktop()); 65 } else { 64 66 setHandlers(eawtApplication, quitHandler, aboutHandler, openFilesHandler, preferencesHandler, proxy, appli); 65 // this method has been deprecated, but without replacement ATM67 // this method has been deprecated, but without replacement. To remove with Java 9 migration 66 68 eawtApplication.getDeclaredMethod("setEnabledPreferencesMenu", boolean.class).invoke(appli, Boolean.TRUE); 67 // setup the dock icon. It is automatically set with application bundle and Web start but we need68 // to do it manually if run with `java -jar``69 eawtApplication.getDeclaredMethod("setDockIconImage", Image.class).invoke(appli, ImageProvider.get("logo").getImage());70 // enable full screen71 enableOSXFullscreen((Window) Main.parent);72 } catch (IllegalAccessException e) {73 Main.debug(e);74 // with Java 9, module java.desktop does not export com.apple.eawt, use new Desktop API instead75 setHandlers(Desktop.class, quitHandler, aboutHandler, openFilesHandler, preferencesHandler, proxy, Desktop.getDesktop());76 69 } 70 // setup the dock icon. It is automatically set with application bundle and Web start but we need 71 // to do it manually if run with `java -jar`` 72 eawtApplication.getDeclaredMethod("setDockIconImage", Image.class).invoke(appli, ImageProvider.get("logo").getImage()); 73 // enable full screen 74 enableOSXFullscreen((Window) Main.parent); 77 75 } catch (ReflectiveOperationException | SecurityException | IllegalArgumentException ex) { 78 76 // We'll just ignore this for now. The user will still be able to close JOSM by closing all its windows. … … 112 110 protected Class<?> findHandlerClass(String className) throws ClassNotFoundException { 113 111 try { 112 // Java 8 handlers 114 113 return Class.forName("com.apple.eawt."+className); 115 114 } catch (ClassNotFoundException e) { 116 115 Main.trace(e); 116 // Java 9 handlers 117 117 return Class.forName("java.awt.desktop."+className); 118 118 }
Note:
See TracChangeset
for help on using the changeset viewer.