aboutsummaryrefslogtreecommitdiffstats
path: root/swtmenubar/src/com/android
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2011-04-26 19:05:02 -0700
committerRaphael Moll <ralf@android.com>2011-04-27 22:54:03 -0700
commit9d333439029e282e9b8fec93e57ebedeb5c4016a (patch)
treeb2fe10462970e0b7afb6c179df86cabff87ff81f /swtmenubar/src/com/android
parenta68694865b6300fc20845d717730de593f2a4776 (diff)
downloadsdk-9d333439029e282e9b8fec93e57ebedeb5c4016a.zip
sdk-9d333439029e282e9b8fec93e57ebedeb5c4016a.tar.gz
sdk-9d333439029e282e9b8fec93e57ebedeb5c4016a.tar.bz2
Cocoa implementation for SwtMenuBar.
Note that in the Android SDK tools, we ship: - SWT in 32-bit with Carbon only. - SWT in 64-bit with Cocoa only. The previous implementation was carbon-only and the menus were basically not 'macified' when running on a recent Mac from the command-line. This missing implementation fixes it. After experimenting with various implementations of the original SWT CocoaMenuEnhancer, I finally settled with this one since it solely uses reflection and does not import anything from the swt.cocoa namespace. This means we can easily build this using the makefile which *only* links with the 32-bit/carbon version of SWT.jar. Note that on Windows/Linux, the src-darwin folder will be ignored, which is why it is not mapped as a source directory and which is why we can't build this directly from Eclipse. Change-Id: I53859d3b15bc7026d6bd4f77e048a0c4b4eeb02c
Diffstat (limited to 'swtmenubar/src/com/android')
-rw-r--r--swtmenubar/src/com/android/menubar/MenuBarEnhancer.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java b/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java
index e40fbe0..dba4f32 100644
--- a/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java
+++ b/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java
@@ -66,15 +66,16 @@ public final class MenuBarEnhancer {
if ("carbon".equals(p)) { //$NON-NLS-1$
className = "com.android.menubar.internal.MenuBarEnhancerCarbon"; //$NON-NLS-1$
} else if ("cocoa".equals(p)) { //$NON-NLS-1$
- // Note: we have a Cocoa implementation that is currently disabled
- // since the SWT.jar that we use only contain Carbon implementations.
- //
- // className = "com.android.menubar.internal.MenuBarEnhancerCocoa"; //$NON-NLS-1$
+ className = "com.android.menubar.internal.MenuBarEnhancerCocoa"; //$NON-NLS-1$
+ }
+
+ if (System.getenv("DEBUG_SWTMENUBAR") != null) {
+ callbacks.printError("DEBUG SwtMenuBar: SWT=%1$s, class=%2$s", p, className);
}
if (className != null) {
try {
- Class<?> clazz = p.getClass().forName(className);
+ Class<?> clazz = Class.forName(className);
enhancer = (IMenuBarEnhancer) clazz.newInstance();
} catch (Exception e) {
// Log an error and fallback on the default implementation.