diff options
author | Raphael <raphael@google.com> | 2011-12-08 14:12:15 -0800 |
---|---|---|
committer | Raphael <raphael@google.com> | 2011-12-08 14:12:15 -0800 |
commit | bec2ac1a3d1420d552a7f5ef270b5768185bf982 (patch) | |
tree | 355213d68bbad6efc3fa5936902a64c19c7acdd2 /sdkmanager | |
parent | 191e6a53717c3e6fc3a9dabc2866f3818c459898 (diff) | |
download | sdk-bec2ac1a3d1420d552a7f5ef270b5768185bf982.zip sdk-bec2ac1a3d1420d552a7f5ef270b5768185bf982.tar.gz sdk-bec2ac1a3d1420d552a7f5ef270b5768185bf982.tar.bz2 |
SDK Manager: fix SWTException disposed when closing during a download.
SDK Bug: 21312
Change-Id: I49462d9750c4f64f92372793dee65d28f23e94ab
Diffstat (limited to 'sdkmanager')
-rwxr-xr-x | sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java index 00315e2..c3b3568 100755 --- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java @@ -992,22 +992,26 @@ public class PackagesPage extends UpdaterPage * Updates the Install and Delete Package buttons. */ private void updateButtonsState() { - int numPackages = getArchivesForInstall(null /*archives*/); - - mButtonInstall.setEnabled((numPackages > 0) && !mOperationPending); - mButtonInstall.setText( - numPackages == 0 ? "Install packages..." : // disabled button case - numPackages == 1 ? "Install 1 package..." : - String.format("Install %d packages...", numPackages)); - - // We can only delete local archives - numPackages = getArchivesToDelete(null /*outMsg*/, null /*outArchives*/); - - mButtonDelete.setEnabled((numPackages > 0) && !mOperationPending); - mButtonDelete.setText( - numPackages == 0 ? "Delete packages..." : // disabled button case - numPackages == 1 ? "Delete 1 package..." : - String.format("Delete %d packages...", numPackages)); + if (!mButtonInstall.isDisposed()) { + int numPackages = getArchivesForInstall(null /*archives*/); + + mButtonInstall.setEnabled((numPackages > 0) && !mOperationPending); + mButtonInstall.setText( + numPackages == 0 ? "Install packages..." : // disabled button case + numPackages == 1 ? "Install 1 package..." : + String.format("Install %d packages...", numPackages)); + } + + if (!mButtonDelete.isDisposed()) { + // We can only delete local archives + int numPackages = getArchivesToDelete(null /*outMsg*/, null /*outArchives*/); + + mButtonDelete.setEnabled((numPackages > 0) && !mOperationPending); + mButtonDelete.setText( + numPackages == 0 ? "Delete packages..." : // disabled button case + numPackages == 1 ? "Delete 1 package..." : + String.format("Delete %d packages...", numPackages)); + } } /** |