Changeset 7485 in josm for trunk


Ignore:
Timestamp:
2014-09-02T02:57:38+02:00 (10 years ago)
Author:
Don-vip
Message:

see #10455 - OS X: show correct dock icon if run with java-jar

File:
1 edited

Legend:

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

    r7482 r7485  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.Image;
    67import java.awt.Window;
    78import java.awt.event.KeyEvent;
     
    4849            Class<?> eawtOpenFilesHandler = Class.forName("com.apple.eawt.OpenFilesHandler");
    4950            Class<?> eawtPreferencesHandler = Class.forName("com.apple.eawt.PreferencesHandler");
    50             Object application = eawtApplication.getConstructor((Class[])null).newInstance((Object[])null);
     51            Object appli = eawtApplication.getConstructor((Class[])null).newInstance((Object[])null);
    5152            Object proxy = Proxy.newProxyInstance(PlatformHookOsx.class.getClassLoader(), new Class<?>[] {
    5253                eawtQuitHandler, eawtAboutHandler, eawtOpenFilesHandler, eawtPreferencesHandler}, ivhandler);
    53             eawtApplication.getDeclaredMethod("setQuitHandler", eawtQuitHandler).invoke(application, proxy);
    54             eawtApplication.getDeclaredMethod("setAboutHandler", eawtAboutHandler).invoke(application, proxy);
    55             eawtApplication.getDeclaredMethod("setOpenFileHandler", eawtOpenFilesHandler).invoke(application, proxy);
    56             eawtApplication.getDeclaredMethod("setPreferencesHandler", eawtPreferencesHandler).invoke(application, proxy);
     54            eawtApplication.getDeclaredMethod("setQuitHandler", eawtQuitHandler).invoke(appli, proxy);
     55            eawtApplication.getDeclaredMethod("setAboutHandler", eawtAboutHandler).invoke(appli, proxy);
     56            eawtApplication.getDeclaredMethod("setOpenFileHandler", eawtOpenFilesHandler).invoke(appli, proxy);
     57            eawtApplication.getDeclaredMethod("setPreferencesHandler", eawtPreferencesHandler).invoke(appli, proxy);
    5758            // this method has been deprecated, but without replacement ATM
    58             eawtApplication.getDeclaredMethod("setEnabledPreferencesMenu", boolean.class).invoke(application, Boolean.TRUE);
     59            eawtApplication.getDeclaredMethod("setEnabledPreferencesMenu", boolean.class).invoke(appli, Boolean.TRUE);
     60            // setup the dock icon. It is automatically set with application bundle and Web start but we need
     61            // to do it manually if run with `java -jar``
     62            eawtApplication.getDeclaredMethod("setDockIconImage", Image.class).invoke(appli, ImageProvider.get("logo").getImage());
    5963            // enable full screen
    6064            enableOSXFullscreen((Window) Main.parent);
Note: See TracChangeset for help on using the changeset viewer.