From 214fa1fb1ce97fa827e74c5930dbcb012db7f3b1 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Sun, 18 Feb 2007 08:44:18 +0000
Subject: [PATCH] improve MacOSX native LAF: set the application name for the menu bar and the dock.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java     |    4 +++-
 opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java         |    4 +++-
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java                    |   14 ++++++++++++++
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java |    2 ++
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
index 8712cb1..d4be8d6 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2006 Sun Microsystems, Inc.
+ *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.quicksetup.installer;
 
@@ -195,6 +195,8 @@
     {
       public void run()
       {
+        // Setup MacOSX native menu bar before AWT is loaded.
+        Utils.setMacOSXMenuBar(getMsg("frame-install-title"));
         SplashScreen.main(args);
         returnValue[0] = 0;
       }
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java
index 44b0c62..a29b1b3 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java
@@ -152,6 +152,8 @@
     {
       public void run()
       {
+        // Setup MacOSX native menu bar before AWT is loaded.
+        Utils.setMacOSXMenuBar(getMsg("frame-uninstall-title"));
         SplashScreen.main(args);
         returnValue[0] = 0;
       }
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index ea4428c..2ab0749 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -1338,4 +1338,18 @@
   {
     return MAX_LINE_WIDTH;
   }
+
+  /**
+   * Puts Swing menus in the Mac OS menu bar, if using the Aqua look and feel,
+   * and sets the application name that is displayed in the application menu
+   * and in the dock.
+   * @param appName
+   *          application name to display in the menu bar and the dock.
+   */
+  public static void setMacOSXMenuBar(String appName)
+  {
+    System.setProperty("apple.laf.useScreenMenuBar", "true");
+    System.setProperty("com.apple.mrj.application.apple.menu.about.name",
+                       appName);
+  }
 }
diff --git a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
index 00c7fe1..53466b3 100644
--- a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
+++ b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2007 Sun Microsystems, Inc.
+ *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.statuspanel;
 
@@ -93,6 +93,8 @@
     {
       public void run()
       {
+        // Setup MacOSX native menu bar before AWT is loaded.
+        Utils.setMacOSXMenuBar(getMsg("statuspanel-dialog-title"));
         SplashScreen.main(args);
         returnValue[0] = 0;
       }

--
Gitblit v1.10.0