diff options
author | Roel Spilker <r.spilker@gmail.com> | 2009-07-14 23:37:04 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2009-07-14 23:37:04 +0200 |
commit | 8ada852308f2823efb12af7795e21eb3ff08f598 (patch) | |
tree | 5d6a031f5a8e6dea3b07f39c840870b4c631f303 /src | |
parent | f99fff3042a96ea509f2e1583fc182b3c4c9f5cd (diff) | |
download | lombok-8ada852308f2823efb12af7795e21eb3ff08f598.tar.gz lombok-8ada852308f2823efb12af7795e21eb3ff08f598.tar.bz2 lombok-8ada852308f2823efb12af7795e21eb3ff08f598.zip |
Used reflection to call Apple native look to avoid errors in a non-mac
development environment
Diffstat (limited to 'src')
-rw-r--r-- | src/lombok/installer/AppleNativeLook.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lombok/installer/AppleNativeLook.java b/src/lombok/installer/AppleNativeLook.java index 1d3cfff7..b2c90555 100644 --- a/src/lombok/installer/AppleNativeLook.java +++ b/src/lombok/installer/AppleNativeLook.java @@ -21,21 +21,23 @@ */ package lombok.installer; -import java.io.IOException; +import java.awt.Image; +import java.awt.image.BufferedImage; import javax.imageio.ImageIO; -import com.apple.eawt.Application; - /** * Mac OS X specific code to gussy up the GUI a little bit, mostly with a nice dock icon. Well, nicer than * the standard icon, at any rate. */ class AppleNativeLook { - public static void go() throws IOException { - Application app = Application.getApplication(); - app.removeAboutMenuItem(); - app.removePreferencesMenuItem(); - app.setDockIconImage(ImageIO.read(AppleNativeLook.class.getResource("lombokIcon.png"))); + public static void go() throws Exception { + Class<?> appClass = Class.forName("com.apple.eawt.Application"); + Object app = appClass.getMethod("getApplication").invoke(null); + appClass.getMethod("removeAboutMenuItem").invoke(app); + appClass.getMethod("removePreferencesMenuItem").invoke(app); + + BufferedImage image = ImageIO.read(AppleNativeLook.class.getResource("lombokIcon.png")); + appClass.getMethod("setDockIconImage", Image.class).invoke(app, image); } } |