SDK Updater: fix install of new packages from remote page.

This commit is contained in:
Raphael
2009-06-17 11:26:10 -07:00
parent 678a781bb5
commit d05f6ef99b
3 changed files with 14 additions and 3 deletions

View File

@@ -241,7 +241,7 @@ public class LocalPackagesPage extends Composite implements ISdkListener {
} }
private void onUpdateInstalledPackage() { private void onUpdateInstalledPackage() {
mUpdaterData.updateAll(null /*selectedArchives*/); mUpdaterData.updateOrInstallAll(null /*selectedArchives*/);
} }
private void onDeleteSelected() { private void onDeleteSelected() {

View File

@@ -292,7 +292,7 @@ public class RemotePackagesPage extends Composite implements ISdkListener {
} }
if (mUpdaterData != null) { if (mUpdaterData != null) {
mUpdaterData.updateAll(archives); mUpdaterData.updateOrInstallAll(archives);
} }
} }

View File

@@ -314,13 +314,24 @@ class UpdaterData {
* This can be null, in which case a list of remote archive is fetched from all * This can be null, in which case a list of remote archive is fetched from all
* available sources. * available sources.
*/ */
public void updateAll(Collection<Archive> selectedArchives) { public void updateOrInstallAll(Collection<Archive> selectedArchives) {
if (selectedArchives == null) { if (selectedArchives == null) {
refreshSources(true); refreshSources(true);
} }
final Map<Archive, Archive> updates = findUpdates(selectedArchives); final Map<Archive, Archive> updates = findUpdates(selectedArchives);
if (selectedArchives != null) {
// Not only we want to perform updates but we also want to install the
// selected archives. If they do not match an update, list them anyway
// except they map themselves to null (no "old" archive)
for (Archive a : selectedArchives) {
if (!updates.containsValue(a)) {
updates.put(a, null);
}
}
}
UpdateChooserDialog dialog = new UpdateChooserDialog(this, updates); UpdateChooserDialog dialog = new UpdateChooserDialog(this, updates);
dialog.open(); dialog.open();