aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/libs/sdkuilib
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2012-05-17 13:04:50 -0700
committerRaphael Moll <ralf@android.com>2012-05-17 17:43:44 -0700
commitfd47d7cf39065ee72b3de3a671a59bae19f9cfec (patch)
treeb5097486fd69e921a561703dbd873cdee0604e6c /sdkmanager/libs/sdkuilib
parent4215c64c8c75fa526af88ed5651693b4dcceef6c (diff)
downloadsdk-fd47d7cf39065ee72b3de3a671a59bae19f9cfec.zip
sdk-fd47d7cf39065ee72b3de3a671a59bae19f9cfec.tar.gz
sdk-fd47d7cf39065ee72b3de3a671a59bae19f9cfec.tar.bz2
SDK Manager: display options menu when invoked from IDE.
Change-Id: I03c75be4d624f841c6f4c0ba93b0951bc8da8850
Diffstat (limited to 'sdkmanager/libs/sdkuilib')
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AvdManagerWindowImpl1.java55
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/SdkUpdaterWindowImpl2.java10
2 files changed, 28 insertions, 37 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 74c061f..0070097 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
@@ -178,6 +178,11 @@ public class AvdManagerWindowImpl1 {
@SuppressWarnings("unused") // MenuBarWrapper works using side effects
private void createMenuBar() {
+ // Only create the menu when running as standalone.
+ // We don't need the menu when invoked from the IDE, or the SDK Manager
+ // or from the AVD Chooser dialog. The only point of the menu is to
+ // get the about box, and invoke Tools > SDK Manager, which we don't
+ // need to do in these cases.
if (mContext != AvdInvocationContext.STANDALONE) {
return;
}
@@ -200,38 +205,30 @@ public class AvdManagerWindowImpl1 {
}
});
- if (mContext != AvdInvocationContext.IDE) {
- // Note: when invoked from an IDE, the SwtMenuBar library isn't
- // available. This means this source should not directly import
- // any of SwtMenuBar classes, otherwise the whole window class
- // would fail to load. The MenuBarWrapper below helps to make
- // that indirection.
-
- try {
- new MenuBarWrapper(APP_NAME_MAC_MENU, menuTools) {
- @Override
- public void onPreferencesMenuSelected() {
- SettingsDialog sd = new SettingsDialog(mShell, mUpdaterData);
- sd.open();
- }
+ try {
+ new MenuBarWrapper(APP_NAME_MAC_MENU, menuTools) {
+ @Override
+ public void onPreferencesMenuSelected() {
+ SettingsDialog sd = new SettingsDialog(mShell, mUpdaterData);
+ sd.open();
+ }
- @Override
- public void onAboutMenuSelected() {
- AboutDialog ad = new AboutDialog(mShell, mUpdaterData);
- ad.open();
- }
+ @Override
+ public void onAboutMenuSelected() {
+ AboutDialog ad = new AboutDialog(mShell, mUpdaterData);
+ ad.open();
+ }
- @Override
- public void printError(String format, Object... args) {
- if (mUpdaterData != null) {
- mUpdaterData.getSdkLog().error(null, format, args);
- }
+ @Override
+ public void printError(String format, Object... args) {
+ if (mUpdaterData != null) {
+ mUpdaterData.getSdkLog().error(null, format, args);
}
- };
- } catch (Exception e) {
- mUpdaterData.getSdkLog().error(e, "Failed to setup menu bar");
- e.printStackTrace();
- }
+ }
+ };
+ } catch (Throwable e) {
+ mUpdaterData.getSdkLog().error(e, "Failed to setup menu bar");
+ e.printStackTrace();
}
}
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 9a7ffe1..7a7a5b3 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
@@ -320,13 +320,7 @@ public class SdkUpdaterWindowImpl2 implements ISdkUpdaterWindow {
mPkgPage.registerMenuAction(
MenuAction.SHOW_ADDON_SITES, manageSources);
- if (mContext == SdkInvocationContext.STANDALONE) {
- // Note: when invoked from an IDE, the SwtMenuBar library isn't
- // available. This means this source should not directly import
- // any of SwtMenuBar classes, otherwise the whole window class
- // would fail to load. The MenuBarWrapper below helps to make
- // that indirection.
-
+ if (mContext == SdkInvocationContext.STANDALONE || mContext == SdkInvocationContext.IDE) {
try {
new MenuBarWrapper(APP_NAME, menuTools) {
@Override
@@ -348,7 +342,7 @@ public class SdkUpdaterWindowImpl2 implements ISdkUpdaterWindow {
}
}
};
- } catch (Exception e) {
+ } catch (Throwable e) {
mUpdaterData.getSdkLog().error(e, "Failed to setup menu bar");
e.printStackTrace();
}