Revision: 6990 Author: [email protected] Date: Wed Nov 18 09:09:47 2009 Log: Merge tr...@6987 to make Development Mode UI integrate with OS X UI better. $ svn merge --ignore-ancestry -c6987 https://google-web-toolkit.googlecode.com/svn/trunk .
http://code.google.com/p/google-web-toolkit/source/detail?r=6990 Modified: /releases/2.0/branch-info.txt /releases/2.0/dev/core/src/com/google/gwt/dev/BootStrapPlatform.java /releases/2.0/dev/core/src/com/google/gwt/dev/SwingUI.java ======================================= --- /releases/2.0/branch-info.txt Wed Nov 18 09:04:51 2009 +++ /releases/2.0/branch-info.txt Wed Nov 18 09:09:47 2009 @@ -770,3 +770,7 @@ Get the XHR memory leak fixed correctly svn merge --ignore-ancestry -c6982 https://google-web-toolkit.googlecode.com/svn/trunk . +tr...@6987 was merged into this branch + Make Development Mode UI integrate with OS X UI better. + svn merge --ignore-ancestry -c6987 https://google-web-toolkit.googlecode.com/svn/trunk . + ======================================= --- /releases/2.0/dev/core/src/com/google/gwt/dev/BootStrapPlatform.java Fri Nov 13 08:09:56 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/BootStrapPlatform.java Wed Nov 18 09:09:47 2009 @@ -37,6 +37,9 @@ */ public static void initGui() { if (isMac() && !GraphicsEnvironment.isHeadless()) { + // This has to be set before any UI components are initialized + System.setProperty("com.apple.mrj.application.apple.menu.about.name", + "Development Mode"); GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); Toolkit.getDefaultToolkit(); } ======================================= --- /releases/2.0/dev/core/src/com/google/gwt/dev/SwingUI.java Wed Nov 18 08:54:38 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/SwingUI.java Wed Nov 18 09:09:47 2009 @@ -224,6 +224,8 @@ setIconImages(topLogger, gwtIcon48, gwtIcon32, gwtIcon64, gwtIcon128, gwtIcon16); frame.setVisible(true); + + maybeInitializeOsXApplication(); } @Override @@ -316,6 +318,52 @@ } return moduleTabPanel; } + + /** + * This method contains code that will call certain Apple extensions to make + * the DevMode app integrate into the system UI a bit better. These methods + * are called reflectively so that we don't have to build gwt-dev against a + * no-op stub library. + */ + private void maybeInitializeOsXApplication() { + Throwable ex; + try { + Class<?> applicationClass = Class.forName("com.apple.eawt.Application"); + + topLogger.log(TreeLogger.SPAM, "Got Application class, on OS X"); + + Object application = applicationClass.getMethod("getApplication").invoke( + null); + assert application != null : "application"; + + // Remove the about menu entry + applicationClass.getMethod("removeAboutMenuItem").invoke(application); + + // Remove the preferences menu entry + applicationClass.getMethod("removePreferencesMenuItem").invoke( + application); + + // Make the Dock icon pretty + applicationClass.getMethod("setDockIconImage", Image.class).invoke( + application, loadImageIcon("icon128.png").getImage()); + + return; + } catch (ClassNotFoundException e) { + // Nothing to do here, this is expected on non-Apple JVMs. + return; + } catch (RuntimeException e) { + ex = e; + } catch (IllegalAccessException e) { + ex = e; + } catch (InvocationTargetException e) { + ex = e; + } catch (NoSuchMethodException e) { + ex = e; + } + + topLogger.log(TreeLogger.WARN, "Unable to initialize some OS X UI support", + ex); + } /** * Set the images for the frame. On JDK 1.5, only the last icon supplied is -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
