aboutsummaryrefslogtreecommitdiffstats
path: root/swtmenubar
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-03-19 09:39:56 -0700
committerTor Norbye <tnorbye@google.com>2012-04-02 16:12:15 -0700
commitb0c819f896b3c579633849e3fa674a30e6978dd7 (patch)
tree312f2cdccb1dc7ec2bbefcd303934848c14c6ac2 /swtmenubar
parentdfe7233d24be55c64cf5f0344f3f97d6aba48bbd (diff)
downloadsdk-b0c819f896b3c579633849e3fa674a30e6978dd7.zip
sdk-b0c819f896b3c579633849e3fa674a30e6978dd7.tar.gz
sdk-b0c819f896b3c579633849e3fa674a30e6978dd7.tar.bz2
Switch libraries from Eclipse 3.4 to Eclipse 3.6.2
This updates the org.eclipse.core.command, org.eclipse.jface and org.eclipse.equinox libraries from Eclipse 3.4 to Eclipse 3.6.2. It also updates SWT from 3.4 to 3.6.2 (and this drops the Carbon support from the SwtMenuBar library since SWT 3.5 switched to Cocoa by default.) Change-Id: I7e8a6e3b8cb473f90eca3b90e3f3dc5fa5099b71
Diffstat (limited to 'swtmenubar')
-rw-r--r--swtmenubar/Android.mk2
-rwxr-xr-xswtmenubar/src-darwin/com/android/menubar/internal/MenuBarEnhancerCarbon.java134
-rw-r--r--swtmenubar/src/com/android/menubar/MenuBarEnhancer.java4
3 files changed, 2 insertions, 138 deletions
diff --git a/swtmenubar/Android.mk b/swtmenubar/Android.mk
index 25e80da..321a78a 100644
--- a/swtmenubar/Android.mk
+++ b/swtmenubar/Android.mk
@@ -29,7 +29,7 @@ LOCAL_MODULE_TAGS := optional
LOCAL_JAVA_LIBRARIES := \
swt \
- org.eclipse.jface_3.4.2.M20090107-0800
+ org.eclipse.jface_3.6.2.M20110210-1200
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/swtmenubar/src-darwin/com/android/menubar/internal/MenuBarEnhancerCarbon.java b/swtmenubar/src-darwin/com/android/menubar/internal/MenuBarEnhancerCarbon.java
deleted file mode 100755
index 45dacfb..0000000
--- a/swtmenubar/src-darwin/com/android/menubar/internal/MenuBarEnhancerCarbon.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.menubar.internal;
-
-import com.android.menubar.IMenuBarCallback;
-import com.android.menubar.IMenuBarEnhancer;
-
-import org.eclipse.swt.internal.Callback;
-import org.eclipse.swt.internal.carbon.HICommand;
-import org.eclipse.swt.internal.carbon.OS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-
-
-/**
- * Implementation of IMenuBarEnhancer for MacOS Carbon SWT.
- */
-public final class MenuBarEnhancerCarbon implements IMenuBarEnhancer {
-
- private static final int kHICommandPreferences = ('p'<<24) + ('r'<<16) + ('e'<<8) + 'f';
- private static final int kHICommandAbout = ('a'<<24) + ('b'<<16) + ('o'<<8) + 'u';
- private static final int kHICommandServices = ('s'<<24) + ('e'<<16) + ('r'<<8) + 'v';
-
- public MenuBarEnhancerCarbon() {
- }
-
- public MenuBarMode getMenuBarMode() {
- return MenuBarMode.MAC_OS;
- }
-
- public void setupMenu(
- String appName,
- Display display,
- final IMenuBarCallback callbacks) {
-
- // Callback target
- Object target = new Object() {
- @SuppressWarnings("unused")
- int commandProc(int nextHandler, int theEvent, int userData) {
- if (OS.GetEventKind(theEvent) == OS.kEventProcessCommand) {
- HICommand command = new HICommand();
- OS.GetEventParameter(
- theEvent,
- OS.kEventParamDirectObject,
- OS.typeHICommand,
- null,
- HICommand.sizeof,
- null,
- command);
- switch (command.commandID) {
- case kHICommandPreferences:
- callbacks.onPreferencesMenuSelected();
- return OS.eventNotHandledErr; // TODO wrong
- case kHICommandAbout:
- callbacks.onAboutMenuSelected();
- return OS.eventNotHandledErr;// TODO wrong
- default:
- break;
- }
- }
- return OS.eventNotHandledErr;
- }
- };
-
- final Callback commandCallback= new Callback(target, "commandProc", 3); //$NON-NLS-1$
- int commandProc = commandCallback.getAddress();
- if (commandProc == 0) {
- commandCallback.dispose();
- log(callbacks, "%1$s: commandProc hook failed.", getClass().getSimpleName()); //$NON-NLS-1$
- return; // give up
- }
-
- // Install event handler for commands
- int[] mask = new int[] {
- OS.kEventClassCommand, OS.kEventProcessCommand
- };
- OS.InstallEventHandler(
- OS.GetApplicationEventTarget(), commandProc, mask.length / 2, mask, 0, null);
-
- // create About Eclipse menu command
- int[] outMenu = new int[1];
- short[] outIndex = new short[1];
- if (OS.GetIndMenuItemWithCommandID(
- 0, kHICommandPreferences, 1, outMenu, outIndex) == OS.noErr && outMenu[0] != 0) {
- int menu = outMenu[0];
-
- // add About menu item (which isn't present by default)
- String about = "About " + appName;
- int l = about.length();
- char buffer[] = new char[l];
- about.getChars(0, l, buffer, 0);
- int str = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, buffer, l);
- OS.InsertMenuItemTextWithCFString(menu, str, (short) 0, 0, kHICommandAbout);
- OS.CFRelease(str);
-
- // add separator between About & Preferences
- OS.InsertMenuItemTextWithCFString(menu, 0, (short) 1, OS.kMenuItemAttrSeparator, 0);
-
- // enable pref menu
- OS.EnableMenuCommand(menu, kHICommandPreferences);
-
- // disable services menu
- OS.DisableMenuCommand(menu, kHICommandServices);
- }
-
- // schedule disposal of callback object
- display.disposeExec(
- new Runnable() {
- public void run() {
- commandCallback.dispose();
- }
- }
- );
- }
-
- private void log(IMenuBarCallback callbacks, String format, Object... args) {
- callbacks.printError(format , args);
- }
-
-}
diff --git a/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java b/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java
index eb3e817..7ca6471 100644
--- a/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java
+++ b/swtmenubar/src/com/android/menubar/MenuBarEnhancer.java
@@ -191,9 +191,7 @@ public final class MenuBarEnhancer {
IMenuBarEnhancer enhancer = null;
String p = SWT.getPlatform();
String className = null;
- if ("carbon".equals(p)) { //$NON-NLS-1$
- className = "com.android.menubar.internal.MenuBarEnhancerCarbon"; //$NON-NLS-1$
- } else if ("cocoa".equals(p)) { //$NON-NLS-1$
+ if ("cocoa".equals(p)) { //$NON-NLS-1$
className = "com.android.menubar.internal.MenuBarEnhancerCocoa"; //$NON-NLS-1$
}