diff options
author | Raphael Moll <ralf@android.com> | 2012-04-17 18:33:24 -0700 |
---|---|---|
committer | Raphael Moll <ralf@android.com> | 2012-04-17 19:09:52 -0700 |
commit | f1a36c2b69c6161b4dd4fbc82c22247c265afff4 (patch) | |
tree | cbe002a17dbf5a07d789f06727a3afbd796f1ad7 /sdkmanager | |
parent | 6b80c7f80e5a13cec02e649d7dbf7e1b90f7f364 (diff) | |
download | sdk-f1a36c2b69c6161b4dd4fbc82c22247c265afff4.zip sdk-f1a36c2b69c6161b4dd4fbc82c22247c265afff4.tar.gz sdk-f1a36c2b69c6161b4dd4fbc82c22247c265afff4.tar.bz2 |
SDK: Open AVD Manager from from AVD Selector > Manager.
SDK Bug: 29026
Change-Id: I036bcd7e23210ebf3991b56211c38c077ef3d308
Diffstat (limited to 'sdkmanager')
4 files changed, 26 insertions, 21 deletions
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AvdManagerWindowImpl1.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AvdManagerWindowImpl1.java index 8277ce2..74c061f 100755 --- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AvdManagerWindowImpl1.java +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AvdManagerWindowImpl1.java @@ -58,6 +58,8 @@ public class AvdManagerWindowImpl1 { private final AvdInvocationContext mContext;
/** Internal data shared between the window and its pages. */
private final UpdaterData mUpdaterData;
+ /** True if this window created the UpdaterData, in which case it needs to dispose it. */
+ private final boolean mOwnUpdaterData;
// --- UI members ---
@@ -82,6 +84,7 @@ public class AvdManagerWindowImpl1 { mParentShell = parentShell;
mContext = context;
mUpdaterData = new UpdaterData(osSdkRoot, sdkLog);
+ mOwnUpdaterData = true;
}
/**
@@ -102,6 +105,7 @@ public class AvdManagerWindowImpl1 { mParentShell = parentShell;
mContext = context;
mUpdaterData = updaterData;
+ mOwnUpdaterData = false;
}
/**
@@ -146,13 +150,8 @@ public class AvdManagerWindowImpl1 { mShell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
- ShellSizeAndPos.saveSizeAndPos(mShell, SIZE_POS_PREFIX);
-
- if (mContext != AvdInvocationContext.SDK_MANAGER) {
- // When invoked from the sdk manager, don't dispose
- // resources that the sdk manager still needs.
- onAndroidSdkUpdaterDispose(); //$hide$ (hide from SWT designer)
- }
+ ShellSizeAndPos.saveSizeAndPos(mShell, SIZE_POS_PREFIX); //$hide$
+ onAndroidSdkUpdaterDispose(); //$hide$
}
});
@@ -322,7 +321,7 @@ public class AvdManagerWindowImpl1 { * Callback called when the window shell is disposed.
*/
private void onAndroidSdkUpdaterDispose() {
- if (mUpdaterData != null) {
+ if (mOwnUpdaterData && mUpdaterData != null) {
ImageFactory imgFactory = mUpdaterData.getImageFactory();
if (imgFactory != null) {
imgFactory.dispose();
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/SdkUpdaterWindowImpl2.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/SdkUpdaterWindowImpl2.java index ab0934a..febbf49 100755 --- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/SdkUpdaterWindowImpl2.java +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/SdkUpdaterWindowImpl2.java @@ -566,7 +566,7 @@ public class SdkUpdaterWindowImpl2 implements ISdkUpdaterWindow { AvdManagerWindowImpl1 win = new AvdManagerWindowImpl1(
mShell,
mUpdaterData,
- AvdInvocationContext.SDK_MANAGER);
+ AvdInvocationContext.DIALOG);
win.open();
} catch (Exception e) {
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java index 8c0057b..daacf10 100644 --- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java @@ -31,9 +31,9 @@ import com.android.sdklib.util.GrabProcessOutput.IProcessOutput; import com.android.sdklib.util.GrabProcessOutput.Wait; import com.android.sdkuilib.internal.repository.SettingsController; import com.android.sdkuilib.internal.repository.icons.ImageFactory; +import com.android.sdkuilib.internal.repository.sdkman2.AvdManagerWindowImpl1; import com.android.sdkuilib.internal.tasks.ProgressTask; -import com.android.sdkuilib.repository.SdkUpdaterWindow; -import com.android.sdkuilib.repository.SdkUpdaterWindow.SdkInvocationContext; +import com.android.sdkuilib.repository.AvdManagerWindow.AvdInvocationContext; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.window.Window; @@ -345,7 +345,7 @@ public final class AvdSelector { mManagerButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - onManager(); + onAvdManager(); } }); } else { @@ -1007,7 +1007,7 @@ public final class AvdSelector { } } - private void onManager() { + private void onAvdManager() { // get the current Display Display display = mTable.getDisplay(); @@ -1020,12 +1020,16 @@ public final class AvdSelector { log = new MessageBoxLog("Result of SDK Manager", display, true /*logErrorsOnly*/); } - SdkUpdaterWindow window = new SdkUpdaterWindow( - mTable.getShell(), - log, - mAvdManager.getSdkManager().getLocation(), - SdkInvocationContext.AVD_SELECTOR); - window.open(); + try { + AvdManagerWindowImpl1 win = new AvdManagerWindowImpl1( + mTable.getShell(), + log, + mOsSdkPath, + AvdInvocationContext.DIALOG); + + win.open(); + } catch (Exception ignore) {} + refresh(true /*reload*/); // UpdaterWindow uses its own AVD manager so this one must reload. if (log instanceof MessageBoxLog) { diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java index 5c601e6..5ad5fc2 100755 --- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/AvdManagerWindow.java @@ -18,6 +18,7 @@ package com.android.sdkuilib.repository; import com.android.sdklib.ISdkLog;
import com.android.sdkuilib.internal.repository.sdkman2.AvdManagerWindowImpl1;
+import com.android.sdkuilib.internal.widgets.AvdSelector;
import org.eclipse.swt.widgets.Shell;
@@ -47,13 +48,14 @@ public class AvdManagerWindow { STANDALONE,
/**
- * The AVD Manager is invoked from the SDK Manager.
+ * The AVD Manager is embedded as a dialog in the SDK Manager
+ * or in the {@link AvdSelector}.
* 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,
+ DIALOG,
/**
* The AVD Manager is invoked from an IDE.
|