aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/icons/avd_manager.pngbin219 -> 269 bytes
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/icons/sdk_manager.pngbin0 -> 219 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml18
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java71
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java (renamed from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkAvdManagerAction.java)6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java4
-rw-r--r--sdkmanager/app/src/com/android/sdkmanager/Main.java7
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerWindowImpl1.java33
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterWindowImpl2.java3
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java112
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/SdkUpdaterWindow.java9
11 files changed, 214 insertions, 49 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/icons/avd_manager.png b/eclipse/plugins/com.android.ide.eclipse.adt/icons/avd_manager.png
index 08ffda8..f8a173c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/icons/avd_manager.png
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/icons/avd_manager.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/icons/sdk_manager.png b/eclipse/plugins/com.android.ide.eclipse.adt/icons/sdk_manager.png
new file mode 100755
index 0000000..08ffda8
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/icons/sdk_manager.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
index a1cafc7..9a956d3 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
@@ -742,14 +742,24 @@
label="Android SDK and AVD Manager"
visible="true">
<action
- class="com.android.ide.eclipse.adt.internal.actions.SdkAvdManagerAction"
+ class="com.android.ide.eclipse.adt.internal.actions.AvdManagerAction"
icon="icons/avd_manager.png"
- id="com.android.ide.eclipse.adt.ui.sdkavdmanager"
- label="Android SDK and AVD Manager"
+ id="com.android.ide.eclipse.adt.ui.avdmanager"
+ label="AVD Manager"
menubarPath="Window/additions"
style="push"
toolbarPath="android_project"
- tooltip="Opens the Android SDK and AVD Manager">
+ tooltip="Opens the Android Virtual Device Manager">
+ </action>
+ <action
+ class="com.android.ide.eclipse.adt.internal.actions.SdkManagerAction"
+ icon="icons/sdk_manager.png"
+ id="com.android.ide.eclipse.adt.ui.sdkmanager"
+ label="Android SDK Manager"
+ menubarPath="Window/additions"
+ style="push"
+ toolbarPath="android_project"
+ tooltip="Opens the Android SDK Manager">
</action>
</actionSet>
</extension>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java
new file mode 100755
index 0000000..ad0548b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2009 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.ide.eclipse.adt.internal.actions;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.sdk.AdtConsoleSdkLog;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.android.sdkuilib.repository.AvdManagerWindow;
+import com.android.sdkuilib.repository.AvdManagerWindow.AvdInvocationContext;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+/**
+ * Delegate for the toolbar/menu action "AVD Manager".
+ * It displays the AVD Manager window.
+ */
+public class AvdManagerAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
+
+ public void dispose() {
+ // nothing to dispose.
+ }
+
+ public void init(IWorkbenchWindow window) {
+ // no init
+ }
+
+ public void run(IAction action) {
+ final Sdk sdk = Sdk.getCurrent();
+ if (sdk != null) {
+
+ // Runs the updater window, directing all logs to the ADT console.
+
+ AvdManagerWindow window = new AvdManagerWindow(
+ AdtPlugin.getDisplay().getActiveShell(),
+ new AdtConsoleSdkLog(),
+ sdk.getSdkLocation(),
+ AvdInvocationContext.IDE);
+ window.open();
+ } else {
+ AdtPlugin.displayError("Android SDK",
+ "Location of the Android SDK has not been setup in the preferences.");
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ // nothing related to the current selection.
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ // nothing to do.
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkAvdManagerAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java
index 605cd8b..d777fcc 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkAvdManagerAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java
@@ -32,10 +32,10 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
- * Delegate for the toolbar/menu action "Android SDK & AVD Manager".
- * It displays the Android SDK & AVD Manager.
+ * Delegate for the toolbar/menu action "Android SDK Manager".
+ * It displays the Android SDK Manager.
*/
-public class SdkAvdManagerAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
+public class SdkManagerAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
public void dispose() {
// nothing to dispose.
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
index 0fb6b3c..1118e2e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
@@ -30,7 +30,7 @@ import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
import com.android.ddmlib.ClientData.DebuggerStatus;
import com.android.ide.eclipse.adt.AdtPlugin;
-import com.android.ide.eclipse.adt.internal.actions.SdkAvdManagerAction;
+import com.android.ide.eclipse.adt.internal.actions.AvdManagerAction;
import com.android.ide.eclipse.adt.internal.launch.AndroidLaunchConfiguration.TargetMode;
import com.android.ide.eclipse.adt.internal.launch.DelayedLaunchInfo.InstallRetryMode;
import com.android.ide.eclipse.adt.internal.launch.DeviceChooserDialog.DeviceChooserResponse;
@@ -497,7 +497,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
Shell shell = display.getActiveShell();
if (MessageDialog.openQuestion(shell, "Android AVD Error",
"No compatible targets were found. Do you wish to a add new Android Virtual Device?")) {
- SdkAvdManagerAction action = new SdkAvdManagerAction();
+ AvdManagerAction action = new AvdManagerAction();
action.run(null /*action*/);
searchAgain[0] = true;
}
diff --git a/sdkmanager/app/src/com/android/sdkmanager/Main.java b/sdkmanager/app/src/com/android/sdkmanager/Main.java
index 461a508..89fb015 100644
--- a/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -39,12 +39,13 @@ import com.android.sdklib.repository.SdkRepoConstants;
import com.android.sdklib.xml.AndroidXPathFactory;
import com.android.sdkmanager.internal.repository.AboutPage;
import com.android.sdkmanager.internal.repository.SettingsPage;
-import com.android.sdkuilib.internal.repository.AvdManagerWindowImpl1;
import com.android.sdkuilib.internal.repository.PackagesPage;
import com.android.sdkuilib.internal.repository.SdkUpdaterNoWindow;
import com.android.sdkuilib.internal.repository.UpdaterPage;
import com.android.sdkuilib.internal.widgets.MessageBoxLog;
+import com.android.sdkuilib.repository.AvdManagerWindow;
import com.android.sdkuilib.repository.SdkUpdaterWindow;
+import com.android.sdkuilib.repository.AvdManagerWindow.AvdInvocationContext;
import com.android.sdkuilib.repository.SdkUpdaterWindow.SdkInvocationContext;
import com.android.util.Pair;
@@ -351,11 +352,11 @@ public class Main {
Display.getCurrent(),
true /*logErrorsOnly*/);
- AvdManagerWindowImpl1 window = new AvdManagerWindowImpl1(
+ AvdManagerWindow window = new AvdManagerWindow(
null /* parentShell */,
errorLogger,
mOsSdkFolder,
- AvdManagerWindowImpl1.AvdInvocationContext.STANDALONE);
+ AvdInvocationContext.STANDALONE);
window.registerPage(SettingsPage.class, UpdaterPage.Purpose.SETTINGS);
window.registerPage(AboutPage.class, UpdaterPage.Purpose.ABOUT_BOX);
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerWindowImpl1.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerWindowImpl1.java
index 7357641..2cfb311 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerWindowImpl1.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerWindowImpl1.java
@@ -24,6 +24,7 @@ import com.android.sdkuilib.internal.repository.UpdaterPage.Purpose;
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
import com.android.sdkuilib.repository.ISdkChangeListener;
import com.android.sdkuilib.repository.SdkUpdaterWindow;
+import com.android.sdkuilib.repository.AvdManagerWindow.AvdInvocationContext;
import com.android.sdkuilib.ui.GridDataBuilder;
import com.android.sdkuilib.ui.GridLayoutBuilder;
import com.android.sdkuilib.ui.SwtBaseDialog;
@@ -56,38 +57,6 @@ public class AvdManagerWindowImpl1 {
private static final String APP_NAME = "Android Virtual Device Manager";
private static final String APP_NAME_MAC_MENU = "AVD Manager";
- /**
- * Enum giving some indication of what is invoking this window.
- * The behavior and UI will change slightly depending on the context.
- * <p/>
- * Note: if you add Android support to your specific IDE, you might want
- * to specialize this context enum.
- */
- public enum AvdInvocationContext {
- /**
- * The AVD Manager is invoked from the stand-alone 'android' tool.
- * In this mode, we present an about box, a settings page.
- * For SdkMan2, we also have a menu bar and link to the SDK Manager 2.
- */
- STANDALONE,
-
- /**
- * The AVD Manager is invoked from the SDK Manager.
- * This is similar to the {@link #STANDALONE} mode except we don't need
- * to display a menu bar at all since we don't want a menu item linking
- * back to the SDK Manager and we don't need to redisplay the options
- * and about which are already on the root window.
- */
- SDK_MANAGER,
-
- /**
- * The AVD Manager is invoked from an IDE.
- * In this mode, we do not modify the menu bar.
- * There is no about box and no settings.
- */
- IDE,
- }
-
private final Shell mParentShell;
private final AvdInvocationContext mContext;
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterWindowImpl2.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterWindowImpl2.java
index 4be4448..8299482 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterWindowImpl2.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterWindowImpl2.java
@@ -28,6 +28,7 @@ import com.android.sdkuilib.internal.tasks.ProgressViewFactory;
import com.android.sdkuilib.internal.widgets.ImgDisabledButton;
import com.android.sdkuilib.internal.widgets.ToggleButton;
import com.android.sdkuilib.repository.ISdkChangeListener;
+import com.android.sdkuilib.repository.AvdManagerWindow.AvdInvocationContext;
import com.android.sdkuilib.repository.SdkUpdaterWindow.SdkInvocationContext;
import com.android.sdkuilib.ui.GridDataBuilder;
import com.android.sdkuilib.ui.GridLayoutBuilder;
@@ -539,7 +540,7 @@ public class SdkUpdaterWindowImpl2 implements ISdkUpdaterWindow {
AvdManagerWindowImpl1 win = new AvdManagerWindowImpl1(
mShell,
mUpdaterData,
- AvdManagerWindowImpl1.AvdInvocationContext.SDK_MANAGER);
+ AvdInvocationContext.SDK_MANAGER);
for (Pair<Class<? extends UpdaterPage>, Purpose> page : mExtraPages) {
win.registerPage(page.getFirst(), page.getSecond());
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java
new file mode 100755
index 0000000..64aadb7
--- /dev/null
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.sdkuilib.repository;
+
+import com.android.sdklib.ISdkLog;
+import com.android.sdkuilib.internal.repository.AvdManagerWindowImpl1;
+import com.android.sdkuilib.internal.repository.UpdaterPage;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Opens an AVD Manager Window.
+ *
+ * This is the public entry point for using the window.
+ */
+public class AvdManagerWindow {
+
+ /** The actual window implementation to which this class delegates. */
+ private AvdManagerWindowImpl1 mWindow;
+
+ /**
+ * Enum giving some indication of what is invoking this window.
+ * The behavior and UI will change slightly depending on the context.
+ * <p/>
+ * Note: if you add Android support to your specific IDE, you might want
+ * to specialize this context enum.
+ */
+ public enum AvdInvocationContext {
+ /**
+ * The AVD Manager is invoked from the stand-alone 'android' tool.
+ * In this mode, we present an about box, a settings page.
+ * For SdkMan2, we also have a menu bar and link to the SDK Manager 2.
+ */
+ STANDALONE,
+
+ /**
+ * The AVD Manager is invoked from the SDK Manager.
+ * This is similar to the {@link #STANDALONE} mode except we don't need
+ * to display a menu bar at all since we don't want a menu item linking
+ * back to the SDK Manager and we don't need to redisplay the options
+ * and about which are already on the root window.
+ */
+ SDK_MANAGER,
+
+ /**
+ * The AVD Manager is invoked from an IDE.
+ * In this mode, we do not modify the menu bar.
+ * There is no about box and no settings.
+ */
+ IDE,
+ }
+
+
+ /**
+ * Creates a new window. Caller must call open(), which will block.
+ *
+ * @param parentShell Parent shell.
+ * @param sdkLog Logger. Cannot be null.
+ * @param osSdkRoot The OS path to the SDK root.
+ * @param context The {@link AvdInvocationContext} to change the behavior depending on who's
+ * opening the SDK Manager.
+ */
+ public AvdManagerWindow(
+ Shell parentShell,
+ ISdkLog sdkLog,
+ String osSdkRoot,
+ AvdInvocationContext context) {
+ mWindow = new AvdManagerWindowImpl1(
+ parentShell,
+ sdkLog,
+ osSdkRoot,
+ context);
+ }
+
+ /**
+ * Registers an extra page for the updater window.
+ * <p/>
+ * Pages must derive from {@link Composite} and implement a constructor that takes
+ * a single parent {@link Composite} argument.
+ * <p/>
+ * All pages must be registered before the call to {@link #open()}.
+ *
+ * @param pageClass The {@link Composite}-derived class that will implement the page.
+ * @param purpose The purpose of this page, e.g. an about box, settings page or generic.
+ */
+ public void registerPage(Class<? extends UpdaterPage> pageClass,
+ UpdaterPage.Purpose purpose) {
+ mWindow.registerPage(pageClass, purpose);
+ }
+
+ /**
+ * Opens the window.
+ */
+ public void open() {
+ mWindow.open();
+ }
+}
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/SdkUpdaterWindow.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/SdkUpdaterWindow.java
index c840a77..5d4e744 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/SdkUpdaterWindow.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/SdkUpdaterWindow.java
@@ -18,9 +18,9 @@ package com.android.sdkuilib.repository;
import com.android.sdklib.ISdkLog;
import com.android.sdkuilib.internal.repository.ISdkUpdaterWindow;
-import com.android.sdkuilib.internal.repository.UpdaterPage;
import com.android.sdkuilib.internal.repository.SdkUpdaterWindowImpl1;
import com.android.sdkuilib.internal.repository.SdkUpdaterWindowImpl2;
+import com.android.sdkuilib.internal.repository.UpdaterPage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
@@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Shell;
*/
public class SdkUpdaterWindow {
- /** The actual window implement to which this class delegates. */
+ /** The actual window implementation to which this class delegates. */
private ISdkUpdaterWindow mWindow;
/**
@@ -87,8 +87,9 @@ public class SdkUpdaterWindow {
String osSdkRoot,
SdkInvocationContext context) {
- // TODO right now the new PackagesPage is experimental and not enabled by default
- if (System.getenv("ANDROID_SDKMAN_EXP") != null) { //$NON-NLS-1$
+ // The new PackagesPage is not activated by default,
+ // this offers a way to fallback on the old one
+ if (System.getenv("ANDROID_OLD_SDKMAN") == null) { //$NON-NLS-1$
mWindow = new SdkUpdaterWindowImpl2(parentShell, sdkLog, osSdkRoot, context);
} else {
mWindow = new SdkUpdaterWindowImpl1(parentShell, sdkLog, osSdkRoot, context);