summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (JBoss)2013-05-02 15:03:31 (EDT)
committerPascal Rapicault2013-05-02 16:48:46 (EDT)
commit83c85716ebfe71e8fa1d2cc12adcfddfd78e1d71 (patch)
treecb27fd936139ded24f799e8b40ecb9eccb25066c
parent697de6584f6ae94e4020d92a541a33405ce9181c (diff)
downloadrt.equinox.p2-83c85716ebfe71e8fa1d2cc12adcfddfd78e1d71.zip
rt.equinox.p2-83c85716ebfe71e8fa1d2cc12adcfddfd78e1d71.tar.gz
rt.equinox.p2-83c85716ebfe71e8fa1d2cc12adcfddfd78e1d71.tar.bz2
Bug 407099 - [Remediation] Operation should not special case isCheckForUpdates
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java4
5 files changed, 27 insertions, 40 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
index df1a4e1..143afc4 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
@@ -38,6 +38,11 @@ public class RemediationOperation extends ProfileChangeOperation {
private Remedy bestSolutionChangingTheRequest;
private Remedy bestSolutionChangingWhatIsInstalled;
private Remedy currentRemedy;
+ private RemedyConfig[] remedyConfigs;
+
+ public RemedyConfig[] getRemedyConfigs() {
+ return remedyConfigs;
+ }
public Remedy getCurrentRemedy() {
return currentRemedy;
@@ -49,26 +54,17 @@ public class RemediationOperation extends ProfileChangeOperation {
}
private IProfileChangeRequest originalRequest;
- private boolean isCheckForUpdates;
-
- public boolean isCheckForUpdates() {
- return isCheckForUpdates;
- }
public RemediationOperation(ProvisioningSession session, IProfileChangeRequest iProfileChangeRequest) {
- this(session, iProfileChangeRequest, null);
-
- }
+ this(session, iProfileChangeRequest, RemedyConfig.getAllRemedyConfigs());
- public RemediationOperation(ProvisioningSession session, IProfileChangeRequest originalRequest, List<RemedyConfig> configuration) {
- this(session, originalRequest, false);
}
- public RemediationOperation(ProvisioningSession session, IProfileChangeRequest originalRequest, boolean isCheckForUpdates) {
+ public RemediationOperation(ProvisioningSession session, IProfileChangeRequest originalRequest, RemedyConfig[] remedyConfigs) {
super(session);
this.originalRequest = originalRequest;
remedies = new ArrayList<Remedy>();
- this.isCheckForUpdates = isCheckForUpdates;
+ this.remedyConfigs = remedyConfigs;
}
public Remedy bestSolutionChangingTheRequest() {
@@ -92,34 +88,14 @@ public class RemediationOperation extends ProfileChangeOperation {
return;
}
try {
- if (isCheckForUpdates)
- status.add(computeCheckForUpdates(sub.newChild(1)));
- else
- status.add(computeAllRemediations(sub.newChild(1)));
+ status.add(computeAllRemediations(sub.newChild(1)));
} catch (OperationCanceledException e) {
status.add(Status.CANCEL_STATUS);
}
- if (!isCheckForUpdates) {
- determineBestSolutions();
- }
- }
-
- private IStatus computeCheckForUpdates(IProgressMonitor monitor) {
- RemedyConfig config = new RemedyConfig();
- config.allowDifferentVersion = true;
- config.allowInstalledRemoval = false;
- config.allowInstalledUpdate = true;
- config.allowPartialInstall = false;
- Remedy remedy = computeRemedy(config, monitor);
- if (remedy != null) {
- remedies.add(remedy);
- }
- return Status.OK_STATUS;
+ determineBestSolutions();
}
private IStatus computeAllRemediations(IProgressMonitor monitor) {
- RemedyConfig[] remedyConfigs = RemedyConfig.getAllRemdyConfigs();
- //SubMonitor sub = SubMonitor.convert(monitor, Messages.RemediationOperation_ProfileChangeRequestProgress, remedyConfigs.length);
SubMonitor sub = SubMonitor.convert(monitor, remedyConfigs.length);
sub.setTaskName(Messages.RemediationOperation_ProfileChangeRequestProgress);
List<Remedy> tmpRemedies = new ArrayList<Remedy>(remedyConfigs.length);
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java
index d18d2b2..a4221d7 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemedyConfig.java
@@ -33,7 +33,18 @@ public class RemedyConfig {
}
- public static RemedyConfig[] getAllRemdyConfigs() {
+ private RemedyConfig(boolean allowPartialInstall, boolean allowDifferentVersion, boolean allowInstalledUpdate, boolean allowInstalledRemoval) {
+ this.allowDifferentVersion = allowDifferentVersion;
+ this.allowInstalledRemoval = allowInstalledRemoval;
+ this.allowInstalledUpdate = allowInstalledUpdate;
+ this.allowPartialInstall = allowPartialInstall;
+ }
+
+ public static RemedyConfig[] getCheckForUpdateRemedyConfigs() {
+ return new RemedyConfig[] {new RemedyConfig(false, true, true, false)};
+ }
+
+ public static RemedyConfig[] getAllRemedyConfigs() {
Collection<RemedyConfig> remedyConfigs = new ArrayList<RemedyConfig>();
int allMasks = (1 << 4);
for (int i = 1; i < allMasks; i++) {
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java
index a416a17..ddeb4f2 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java
@@ -47,11 +47,11 @@ public class UpdateHandler extends PreloadingRepositoryHandler {
getProvisioningUI().openUpdateWizard(false, operation, job);
} else {
- final RemediationOperation remediationOperation = new RemediationOperation(getProvisioningUI().getSession(), operation.getProfileChangeRequest(), true);
+ final RemediationOperation remediationOperation = new RemediationOperation(getProvisioningUI().getSession(), operation.getProfileChangeRequest(), RemedyConfig.getCheckForUpdateRemedyConfigs());
ProvisioningJob job2 = new ProvisioningJob("Searching alternate solutions...", getProvisioningUI().getSession()) {
@Override
public IStatus runModal(IProgressMonitor monitor) {
- monitor.beginTask("Some items cannot be at the highest version. Searching for the highest common denominator ...", RemedyConfig.getAllRemdyConfigs().length);
+ monitor.beginTask("Some items cannot be at the highest version. Searching for the highest common denominator ...", RemedyConfig.getAllRemedyConfigs().length);
return remediationOperation.resolveModal(monitor);
}
};
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
index eb7e600..3bf6f63 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
@@ -83,7 +83,7 @@ public class UpdateAction extends ExistingIUInProfileAction {
ProvisioningJob job = new ProvisioningJob("Searching alternate solutions...", getSession()) {
@Override
public IStatus runModal(IProgressMonitor monitor) {
- monitor.beginTask("The update operation cannot be completed as requested. Searching alternate solutions ...", RemedyConfig.getAllRemdyConfigs().length);
+ monitor.beginTask("The update operation cannot be completed as requested. Searching alternate solutions ...", RemedyConfig.getAllRemedyConfigs().length);
return remediationOperation.resolveModal(monitor);
}
};
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 ba2af24..1681d66 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
@@ -161,7 +161,7 @@ public abstract class ProvisioningOperationWizard extends Wizard {
IStatus status = operation.getResolutionResult();
if (status == null || status.getSeverity() == IStatus.ERROR) {
if (page == mainPage) {
- if (remediationOperation != null && remediationOperation.getResolutionResult() == Status.OK_STATUS && remediationOperation.isCheckForUpdates()) {
+ if (remediationOperation != null && remediationOperation.getResolutionResult() == Status.OK_STATUS && remediationOperation.getRemedyConfigs().length == 1) {
planChanged();
return getNextPage(remediationPage);
}
@@ -259,7 +259,7 @@ public abstract class ProvisioningOperationWizard extends Wizard {
}
public void computeRemediationOperation(ProfileChangeOperation op, ProvisioningUI ui, IProgressMonitor monitor) {
- SubMonitor sub = SubMonitor.convert(monitor, ProvUIMessages.ProvisioningOperationWizard_Remediation_Operation, RemedyConfig.getAllRemdyConfigs().length);
+ SubMonitor sub = SubMonitor.convert(monitor, ProvUIMessages.ProvisioningOperationWizard_Remediation_Operation, RemedyConfig.getAllRemedyConfigs().length);
monitor.setTaskName(ProvUIMessages.ProvisioningOperationWizard_Remediation_Operation);
remediationOperation = new RemediationOperation(ui.getSession(), op.getProfileChangeRequest());
remediationOperation.resolveModal(monitor);