diff options
author | Raphael Moll <ralf@android.com> | 2011-04-15 14:42:17 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-04-15 14:42:17 -0700 |
commit | f72b32fb3d4c173d447fe3b48574a1242390d3ed (patch) | |
tree | 9c572b76bc333a93670fbf5b19d13fb2003a3130 /sdkmanager | |
parent | b53e1906c389a1cece945cafce866933efeda4c2 (diff) | |
parent | 966081a59165dabb218857cb0df54eab8356d86e (diff) | |
download | sdk-f72b32fb3d4c173d447fe3b48574a1242390d3ed.zip sdk-f72b32fb3d4c173d447fe3b48574a1242390d3ed.tar.gz sdk-f72b32fb3d4c173d447fe3b48574a1242390d3ed.tar.bz2 |
Merge "Use swtmenubar in SDK Manager 2."
Diffstat (limited to 'sdkmanager')
-rw-r--r-- | sdkmanager/app/etc/manifest.txt | 2 | ||||
-rw-r--r-- | sdkmanager/libs/sdkuilib/.classpath | 20 | ||||
-rw-r--r-- | sdkmanager/libs/sdkuilib/Android.mk | 3 | ||||
-rw-r--r-- | sdkmanager/libs/sdkuilib/README | 38 | ||||
-rwxr-xr-x | sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl2.java | 83 |
5 files changed, 124 insertions, 22 deletions
diff --git a/sdkmanager/app/etc/manifest.txt b/sdkmanager/app/etc/manifest.txt index 51845c7..bb2e8c4 100644 --- a/sdkmanager/app/etc/manifest.txt +++ b/sdkmanager/app/etc/manifest.txt @@ -1,2 +1,2 @@ Main-Class: com.android.sdkmanager.Main -Class-Path: androidprefs.jar common.jar sdklib.jar sdkuilib.jar org.eclipse.jface_3.4.2.M20090107-0800.jar org.eclipse.equinox.common_3.4.0.v20080421-2006.jar org.eclipse.core.commands_3.4.0.I20080509-2000.jar +Class-Path: androidprefs.jar common.jar sdklib.jar sdkuilib.jar swtmenubar.jar org.eclipse.jface_3.4.2.M20090107-0800.jar org.eclipse.equinox.common_3.4.0.v20080421-2006.jar org.eclipse.core.commands_3.4.0.I20080509-2000.jar diff --git a/sdkmanager/libs/sdkuilib/.classpath b/sdkmanager/libs/sdkuilib/.classpath index 751e043..7f1dec3 100644 --- a/sdkmanager/libs/sdkuilib/.classpath +++ b/sdkmanager/libs/sdkuilib/.classpath @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry excluding="**/Android.mk" kind="src" path="src"/> - <classpathentry excluding="**/Android.mk" kind="src" path="tests"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANDROID_SWT"/> - <classpathentry combineaccessrules="false" kind="src" path="/SdkLib"/> - <classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/> - <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> - <classpathentry combineaccessrules="false" kind="src" path="/common"/> - <classpathentry kind="output" path="bin"/> + <classpathentry excluding="**/Android.mk" kind="src" path="src"/> + <classpathentry excluding="**/Android.mk" kind="src" path="tests"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANDROID_SWT"/> + <classpathentry combineaccessrules="false" kind="src" path="/SdkLib"/> + <classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/> + <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> + <classpathentry combineaccessrules="false" kind="src" path="/common"/> + <classpathentry kind="var" path="ANDROID_OUT_FRAMEWORK/swtmenubar.jar"/> + <classpathentry kind="output" path="bin"/> </classpath> - diff --git a/sdkmanager/libs/sdkuilib/Android.mk b/sdkmanager/libs/sdkuilib/Android.mk index 671fc95..740615e 100644 --- a/sdkmanager/libs/sdkuilib/Android.mk +++ b/sdkmanager/libs/sdkuilib/Android.mk @@ -27,11 +27,12 @@ LOCAL_JAVA_LIBRARIES := \ sdklib \ common \ androidprefs \ + swtmenubar \ swt \ org.eclipse.jface_3.4.2.M20090107-0800 \ org.eclipse.equinox.common_3.4.0.v20080421-2006 \ org.eclipse.core.commands_3.4.0.I20080509-2000 - + LOCAL_MODULE := sdkuilib include $(BUILD_HOST_JAVA_LIBRARY) diff --git a/sdkmanager/libs/sdkuilib/README b/sdkmanager/libs/sdkuilib/README index d66b84a..3d68520 100644 --- a/sdkmanager/libs/sdkuilib/README +++ b/sdkmanager/libs/sdkuilib/README @@ -1,11 +1,39 @@ -Using the Eclipse projects for ddmuilib. +Using the Eclipse project SdkUiLib +---------------------------------- -ddmuilib requires SWT to compile. +1- sdkuilib requires SWT to compile. -SWT is available in the depot under prebuild/<platform>/swt +SWT is available in the tree under prebuild/<platform>/swt Because the build path cannot contain relative path that are not inside the project directory, the .classpath file references a user library called ANDROID_SWT. -In order to compile the project, make a user library called ANDROID_SWT containing the jar -available at prebuild/<platform>/swt.
\ No newline at end of file +In order to compile the project: +- Open Preferences > Java > Build Path > User Libraries +- Create a new user library named ANDROID_SWT +- Add the following 4 JAR files: + + - prebuild/<platform>/swt/swt.jar + - prebuilt/common/eclipse/org.eclipse.core.commands_3.*.jar + - prebuilt/common/eclipse/org.eclipse.equinox.common_3.*.jar + - prebuilt/common/eclipse/org.eclipse.jface_3.*.jar + + +2- sdkuilib also requires the compiled swtmenubar library. + +Build the swtmenubar library: +$ cd $TOP (top of Android tree) +$ . build/envsetup.sh && lunch sdk-eng +$ sdk/eclipse/scripts/create_sdkman_symlinks.sh + +Define a classpath variable in Eclipse: +- Open Preferences > Java > Build Path > Classpath Variables +- Create a new classpath variable named ANDROID_OUT_FRAMEWORK +- Set its folder value to <Android tree>/out/host/<platform>/framework + +You might need to clean the SdkUiLib project (Project > Clean...) after +you add the new classpath variable, otherwise previous errors might not +go away automatically. + +-- +EOF diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl2.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl2.java index 83a86b2..dfdf886 100755 --- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl2.java +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl2.java @@ -17,15 +17,17 @@ package com.android.sdkuilib.internal.repository;
+import com.android.menubar.IMenuBarCallback;
+import com.android.menubar.MenuBarEnhancer;
import com.android.sdklib.ISdkLog;
import com.android.sdklib.SdkConstants;
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
-import com.android.sdkuilib.internal.tasks.ProgressTaskFactory;
import com.android.sdkuilib.internal.tasks.ProgressView;
import com.android.sdkuilib.internal.tasks.ProgressViewFactory;
import com.android.sdkuilib.repository.ISdkChangeListener;
import com.android.sdkuilib.repository.IUpdaterWindow;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.DisposeEvent;
@@ -42,6 +44,8 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
@@ -55,6 +59,7 @@ import java.util.ArrayList; */
public class UpdaterWindowImpl2 implements IUpdaterWindow {
+ private static final String APP_NAME = "Android SDK Manager";
private final Shell mParentShell;
/** Internal data shared between the window and its pages. */
private final UpdaterData mUpdaterData;
@@ -91,10 +96,11 @@ public class UpdaterWindowImpl2 implements IUpdaterWindow { */
public void open() {
if (mParentShell == null) {
- Display.setAppName("Android"); //$hide$ (hide from SWT designer)
+ Display.setAppName(APP_NAME); //$hide$ (hide from SWT designer)
}
createShell();
+ createMenuBar();
preCreateContent();
createContents();
mShell.open();
@@ -129,11 +135,10 @@ public class UpdaterWindowImpl2 implements IUpdaterWindow { mShell.setMinimumSize(new Point(500, 300));
mShell.setSize(700, 500);
- mShell.setText("Android SDK and AVD Manager");
+ mShell.setText(APP_NAME);
}
private void createContents() {
- mShell.setText("Android SDK Manager");
mPkgPage = new PackagesPage(mShell, mUpdaterData);
mPkgPage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
@@ -171,6 +176,73 @@ public class UpdaterWindowImpl2 implements IUpdaterWindow { });
}
+ private void createMenuBar() {
+
+ Menu menuBar = new Menu(mShell, SWT.BAR);
+ mShell.setMenuBar(menuBar);
+
+ MenuItem menuBarPackages = new MenuItem(menuBar, SWT.CASCADE);
+ menuBarPackages.setText("Packages");
+
+ Menu menuPkgs = new Menu(menuBarPackages);
+ menuBarPackages.setMenu(menuPkgs);
+
+ MenuItem ShowUpdatesnew = new MenuItem(menuPkgs, SWT.NONE);
+ ShowUpdatesnew.setText("Show Updates/New Packages");
+
+ MenuItem ShowInstalled = new MenuItem(menuPkgs, SWT.NONE);
+ ShowInstalled.setText("Show Installed Packages");
+
+ MenuItem ShowObsoletePackages = new MenuItem(menuPkgs, SWT.NONE);
+ ShowObsoletePackages.setText("Show Obsolete Packages");
+
+ MenuItem ShowArchives = new MenuItem(menuPkgs, SWT.NONE);
+ ShowArchives.setText("Show Archives");
+
+ new MenuItem(menuPkgs, SWT.SEPARATOR);
+
+ MenuItem sortByApi = new MenuItem(menuPkgs, SWT.NONE);
+ sortByApi.setText("Sort by API Level");
+
+ MenuItem sortBySource = new MenuItem(menuPkgs, SWT.NONE);
+ sortBySource.setText("Sort by Source");
+
+ new MenuItem(menuPkgs, SWT.SEPARATOR);
+
+ MenuItem reload = new MenuItem(menuPkgs, SWT.NONE);
+ reload.setText("Reload");
+
+ MenuItem menuBarTools = new MenuItem(menuBar, SWT.CASCADE);
+ menuBarTools.setText("Tools");
+
+ Menu menuTools = new Menu(menuBarTools);
+ menuBarTools.setMenu(menuTools);
+
+ MenuItem manageAvds = new MenuItem(menuTools, SWT.NONE);
+ manageAvds.setText("Manage AVDs...");
+
+ MenuItem manageSources = new MenuItem(menuTools, SWT.NONE);
+ manageSources.setText("Manage Sources...");
+
+ MenuBarEnhancer.setupMenu(APP_NAME, menuTools, new IMenuBarCallback() {
+ public void onPreferencesMenuSelected() {
+ // TODO: plug settings page here
+ MessageDialog.openInformation(mShell, "test", "on prefs");
+ }
+
+ public void onAboutMenuSelected() {
+ // TODO: plug about page here
+ MessageDialog.openInformation(mShell, "test", "on about");
+ }
+
+ public void printError(String format, Object... args) {
+ if (mUpdaterData != null) {
+ mUpdaterData.getSdkLog().warning(format, args);
+ }
+ }
+ });
+ }
+
private Image getImage(String filename) {
if (mUpdaterData != null) {
ImageFactory imgFactory = mUpdaterData.getImageFactory();
@@ -247,9 +319,10 @@ public class UpdaterWindowImpl2 implements IUpdaterWindow { */
private void preCreateContent() {
mUpdaterData.setWindowShell(mShell);
+ // We need the UI factory to create the UI
mUpdaterData.setImageFactory(new ImageFactory(mShell.getDisplay()));
// Note: we can't create the TaskFactory yet because we need the UI
- // to be created first. And the UI needs the ImageFactory to be set.
+ // to be created first, so this is done in postCreateContent().
}
/**
|