Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2010-01-23 16:27:27 +0000
committerSusan Franklin2010-01-23 16:27:27 +0000
commitbc3ce087cea1293e57fd36a263013bcf3bbcd928 (patch)
tree5f1692249bb59894aed4c39c12bee532c2510dc9 /bundles
parent90af1c0c2ed649eed074316dc5c1d55d4bc9ffcd (diff)
downloadrt.equinox.p2-bc3ce087cea1293e57fd36a263013bcf3bbcd928.tar.gz
rt.equinox.p2-bc3ce087cea1293e57fd36a263013bcf3bbcd928.tar.xz
rt.equinox.p2-bc3ce087cea1293e57fd36a263013bcf3bbcd928.zip
Bug 300240 - [ui] Not all versions of updates are shown
Bug 300445 - [ui] Can't update from I20100119-0800
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java41
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java3
9 files changed, 85 insertions, 81 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
index 0f05b6c07..b28e2f62f 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java
@@ -96,7 +96,7 @@ public class UpdateOperation extends ProfileChangeOperation {
* updates.
*/
public void setSelectedUpdates(Update[] defaultUpdates) {
- this.defaultUpdates = Arrays.asList(defaultUpdates);
+ this.defaultUpdates = new ArrayList<Update>(Arrays.asList(defaultUpdates));
}
/**
@@ -160,7 +160,7 @@ public class UpdateOperation extends ProfileChangeOperation {
// IU should not be removed as part of the update.
Set<IInstallableUnit> toBeUpdated = new HashSet<IInstallableUnit>();
HashSet<Update> elementsToPlan = new HashSet<Update>();
- boolean selectionSpecified = false;
+ boolean selectionSpecified = defaultUpdates != null;
IProfile profile = session.getProfileRegistry().getProfile(profileId);
if (profile == null)
return;
@@ -173,7 +173,6 @@ public class UpdateOperation extends ProfileChangeOperation {
toBeUpdated.add(iusToUpdate[i]);
if (defaultUpdates != null && defaultUpdates.contains(updates[j])) {
elementsToPlan.add(updates[j]);
- selectionSpecified = true;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
index e7a51619c..b8eba8582 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
@@ -10,21 +10,14 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.dialogs;
-import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.metadata.VersionRange;
-
-import org.eclipse.equinox.p2.metadata.IProvidedCapability;
-import org.eclipse.equinox.p2.metadata.IUpdateDescriptor;
-
-import org.eclipse.equinox.p2.metadata.ILicense;
-
import org.eclipse.equinox.internal.p2.metadata.License;
import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.dialogs.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.*;
+import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
-import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.operations.ProfileModificationJob;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardDialog;
@@ -172,32 +165,6 @@ public class UpdateWizardTest extends WizardTest {
}
/**
- * Tests the wizard without a prior resolution being done.
- * This is not the SDK workflow, but should be supported.
- */
- public void testUpdateWizardUnresolved() {
- Update update = new Update(main, mainUpgrade1);
- UpdateOperation op = getProvisioningUI().getUpdateOperation(new IInstallableUnit[] {main}, null);
- UpdateWizard wizard = new UpdateWizard(getProvisioningUI(), op, new Object[] {update}, null);
- WizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
-
- try {
- SelectableIUsPage page1 = (SelectableIUsPage) wizard.getPage(SELECTION_PAGE);
- // Page 1 should have selections
- assertTrue(page1.isPageComplete());
- // Should be able to resolve an unresolved operation
- wizard.recomputePlan(dialog);
- // Everything is still good
- assertTrue(page1.isPageComplete());
-
- } finally {
- dialog.getShell().close();
- }
- }
-
- /**
* Tests the wizard when multiple versions are available.
*/
public void testBug277554MultipleVersions() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
index 3bcf45fd2..a5e83d9e6 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
@@ -31,7 +31,6 @@ import org.eclipse.jface.wizard.IWizardPage;
public class InstallWizard extends WizardWithLicenses {
SelectableIUsPage errorReportingPage;
- IUElementListRoot originalRoot;
public InstallWizard(ProvisioningUI ui, InstallOperation operation, IInstallableUnit[] initialSelections, LoadMetadataRepositoryJob preloadJob) {
super(ui, operation, initialSelections, preloadJob);
@@ -84,28 +83,6 @@ public class InstallWizard extends WizardWithLicenses {
return errorReportingPage;
}
- protected void planChanged() {
- // the superclass may change the page root when we don't wish this to happen.
- // The code below will correct that case. We set redraw to avoid a big flash.
- errorReportingPage.getControl().setRedraw(false);
- try {
- super.planChanged();
- // We don't want the root of the error page to change unless we are on the
- // main page. For example, if we are on the error page, change checkmarks, and
- // resolve again with an error, we wouldn't want the root items to change in the
- // error page.
- if (getContainer().getCurrentPage() == mainPage) {
- originalRoot = root;
- } else {
- errorReportingPage.updateStatus(originalRoot, operation);
- }
- // we always update the checkmarks to the current root
- errorReportingPage.setCheckedElements(root.getChildren(root));
- } finally {
- errorReportingPage.getControl().setRedraw(true);
- }
- }
-
/*
* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
@@ -127,4 +104,12 @@ public class InstallWizard extends WizardWithLicenses {
// op.setRootMarkerKey(getRootMarkerKey());
return op;
}
+
+ protected boolean shouldUpdateErrorPageModelOnPlanChange() {
+ // We don't want the root of the error page to change unless we are on the
+ // main page. For example, if we are on the error page, change checkmarks, and
+ // resolve again with an error, we wouldn't want the root items to change in the
+ // error page.
+ return getContainer().getCurrentPage() == mainPage && super.shouldUpdateErrorPageModelOnPlanChange();
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
index d23c9a352..28233c9ea 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
@@ -167,12 +167,17 @@ public abstract class ProvisioningOperationWizard extends Wizard {
}
protected void planChanged() {
- errorPage.updateStatus(root, operation);
+ resolutionPage.updateStatus(root, operation);
if (errorPage != resolutionPage) {
- resolutionPage.updateStatus(root, operation);
+ IUElementListRoot newRoot = shouldUpdateErrorPageModelOnPlanChange() ? root : null;
+ errorPage.updateStatus(newRoot, operation);
}
}
+ protected boolean shouldUpdateErrorPageModelOnPlanChange() {
+ return errorPage != mainPage;
+ }
+
protected abstract void initializeResolutionModelElements(Object[] selectedElements);
protected ProvisioningContext getProvisioningContext() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
index 5ee5043e3..eeb4aebf9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
@@ -222,14 +222,16 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
protected void updateCaches(IUElementListRoot newRoot, ProfileChangeOperation op) {
resolvedOperation = op;
- setDrilldownElements(newRoot, resolvedOperation);
- if (treeViewer != null) {
- if (input != newRoot)
- treeViewer.setInput(newRoot);
- else
- treeViewer.refresh();
+ if (newRoot != null) {
+ setDrilldownElements(newRoot, resolvedOperation);
+ if (treeViewer != null) {
+ if (input != newRoot)
+ treeViewer.setInput(newRoot);
+ else
+ treeViewer.refresh();
+ }
+ input = newRoot;
}
- input = newRoot;
}
protected String getDialogSettingsName() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
index 442759296..3f8f10705 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
@@ -47,6 +47,11 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
super(pageName, ui, wizard);
}
+ /**
+ * Update the caches associated with this page.
+ * @param root the new root, or <code>null</code> if the root should not be updated.
+ * @param resolvedOperation the new operation
+ */
protected abstract void updateCaches(IUElementListRoot root, ProfileChangeOperation resolvedOperation);
protected abstract boolean isCreated();
@@ -58,7 +63,9 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
/**
* Update the status area of the wizard to report the results of the operation.
*
- * @param newRoot the root that describes the root IUs involved in creating the plan
+ * @param newRoot the root that describes the root IUs involved in creating the plan.
+ * This can be <code>null</code> if the root should not be updated.
+ *
* @param op the ProfileChangeOperation that describes the operation
*/
public void updateStatus(IUElementListRoot newRoot, ProfileChangeOperation op) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
index 369479eba..0af6d74b3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
@@ -119,9 +119,9 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
contentProvider = new ProvElementContentProvider();
tableViewer.setContentProvider(contentProvider);
- tableViewer.setInput(root);
labelProvider = new IUDetailsLabelProvider(null, ProvUI.getIUColumnConfig(), getShell());
tableViewer.setLabelProvider(labelProvider);
+ tableViewer.setInput(root);
setInitialCheckState();
// Select and Deselect All buttons
@@ -262,11 +262,18 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
return tableViewer != null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ResolutionStatusPage#updateCaches(org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot, org.eclipse.equinox.p2.operations.ProfileChangeOperation)
+ */
protected void updateCaches(IUElementListRoot newRoot, ProfileChangeOperation op) {
resolvedOperation = op;
- if (root != newRoot && tableViewer != null)
- tableViewer.setInput(newRoot);
- root = newRoot;
+ if (newRoot != null && root != newRoot) {
+ root = newRoot;
+ if (tableViewer != null)
+ tableViewer.setInput(newRoot);
+ }
+
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
index 56b975a35..c983f8320 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
@@ -12,6 +12,7 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.util.*;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement;
@@ -28,6 +29,7 @@ import org.eclipse.jface.wizard.IWizardPage;
public class UpdateWizard extends WizardWithLicenses {
IInstallableUnit[] iusToReplace;
boolean skipSelectionsPage = false;
+ IUElementListRoot firstPageRoot;
public static IInstallableUnit[] getIUsToReplace(Object[] elements) {
Set<IInstallableUnit> iusToReplace = new HashSet<IInstallableUnit>();
@@ -59,17 +61,27 @@ public class UpdateWizard extends WizardWithLicenses {
return updates.toArray(new Update[updates.size()]);
}
+ /**
+ * Open an update wizard. For update wizards, the operation must have been resolved in advanced.
+ * This prevents searching for updates in the UI thread.
+ *
+ * @param ui the provisioning UI
+ * @param operation the update operation. Must already be resolved!
+ * @param initialSelections initial selections for the wizard (can be null)
+ * @param preloadJob a job that has been used to preload metadata repositories (can be null)
+ */
public UpdateWizard(ProvisioningUI ui, UpdateOperation operation, Object[] initialSelections, LoadMetadataRepositoryJob preloadJob) {
super(ui, operation, initialSelections, preloadJob);
+ Assert.isLegal(operation.hasResolved(), "Cannot create an update wizard on an unresolved operation"); //$NON-NLS-1$
setWindowTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UPDATE));
}
protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
- mainPage = new SelectableIUsPage(ui, this, input, selections);
+ mainPage = new SelectableIUsPage(ui, this, getAllPossibleUpdatesRoot(), selections);
mainPage.setTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
mainPage.setDescription(ProvUIMessages.UpdateAction_UpdatesAvailableMessage);
- ((SelectableIUsPage) mainPage).updateStatus(input, operation);
+ ((SelectableIUsPage) mainPage).updateStatus(getAllPossibleUpdatesRoot(), operation);
return mainPage;
}
@@ -131,4 +143,25 @@ public class UpdateWizard extends WizardWithLicenses {
}
return operation;
}
+
+ private IUElementListRoot getAllPossibleUpdatesRoot() {
+ if (firstPageRoot == null) {
+ firstPageRoot = new IUElementListRoot();
+ if (operation != null && operation instanceof UpdateOperation) {
+ Update[] updates;
+ if (getPolicy().getShowLatestVersionsOnly()) {
+ updates = ((UpdateOperation) operation).getSelectedUpdates();
+ } else {
+ updates = ((UpdateOperation) operation).getPossibleUpdates();
+ }
+ ArrayList<AvailableUpdateElement> allPossible = new ArrayList<AvailableUpdateElement>(updates.length);
+ for (int i = 0; i < updates.length; i++) {
+ AvailableUpdateElement newElement = new AvailableUpdateElement(firstPageRoot, updates[i].replacement, updates[i].toUpdate, getProfileId(), shouldShowProvisioningPlanChildren());
+ allPossible.add(newElement);
+ }
+ firstPageRoot.setChildren(allPossible.toArray());
+ }
+ }
+ return firstPageRoot;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
index 9ec5fe391..38423ea35 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.p2.ui;
-import org.eclipse.equinox.p2.metadata.ILicense;
-
import java.util.*;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
@@ -22,6 +20,7 @@ import org.eclipse.equinox.internal.p2.ui.dialogs.ILayoutConstants;
import org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.ILicense;
import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
import org.eclipse.jface.dialogs.Dialog;

Back to the top