Changeset 12268 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-05-28T19:24:09+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.