summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2011-09-21 17:11:07 (EDT)
committerirbull2011-10-17 17:16:06 (EDT)
commit90dccc1f502df468b48e30720f548e1af500a45c (patch)
treed26bbb4e226cb77971eb0a4afb05bff4f3ab7765
parent18eb6e1529e93f1dce2cf59eba948b54b5c138c3 (diff)
downloadrt.equinox.p2-90dccc1f502df468b48e30720f548e1af500a45c.zip
rt.equinox.p2-90dccc1f502df468b48e30720f548e1af500a45c.tar.gz
rt.equinox.p2-90dccc1f502df468b48e30720f548e1af500a45c.tar.bz2
Created a checkbox that allows users to run a plan with relaxed constraints.irbull/lucky3
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/LuckyOperation.java177
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java7
9 files changed, 305 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF
index 5d72f5d..0c930e7 100644
--- a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF
@@ -16,6 +16,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5,
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.director,
+ org.eclipse.equinox.internal.p2.metadata.query,
org.eclipse.equinox.internal.p2.repository.helpers,
org.eclipse.equinox.internal.provisional.configurator,
org.eclipse.equinox.internal.provisional.p2.core.eventbus,
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/LuckyOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/LuckyOperation.java
new file mode 100644
index 0000000..4d9a9e1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/LuckyOperation.java
@@ -0,0 +1,177 @@
+package org.eclipse.equinox.p2.operations;
+
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
+import org.eclipse.equinox.internal.p2.metadata.query.UpdateQuery;
+import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery;
+import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.planner.*;
+import org.eclipse.equinox.p2.query.*;
+
+/**
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ * @noreference
+ */
+public class LuckyOperation extends ProfileChangeOperation {
+
+ public LuckyOperation(ProvisioningSession session) {
+ super(session);
+ }
+
+ @Override
+ protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
+ IProfileRegistry profileRegistry = (IProfileRegistry) session.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
+ IPlanner plan = (IPlanner) session.getProvisioningAgent().getService(IPlanner.SERVICE_NAME);
+ IProfile prof = profileRegistry.getProfile(getProfileId());
+
+ final String INCLUSION_RULES = "org.eclipse.equinox.p2.internal.inclusion.rules"; //$NON-NLS-1$
+ final String INCLUSION_OPTIONAL = "OPTIONAL"; //$NON-NLS-1$
+ final String INCLUSION_STRICT = "STRICT"; //$NON-NLS-1$
+
+ IQueryResult<IInstallableUnit> strictRoots = prof.query(new IUProfilePropertyQuery(INCLUSION_RULES, INCLUSION_STRICT), null);
+ IQueryResult<IInstallableUnit> optionalRoots = prof.query(new IUProfilePropertyQuery(INCLUSION_RULES, INCLUSION_OPTIONAL), null);
+ Set<IInstallableUnit> tmpRoots = new HashSet<IInstallableUnit>(strictRoots.toUnmodifiableSet());
+ tmpRoots.addAll(optionalRoots.toUnmodifiableSet());
+ CollectionResult<IInstallableUnit> allRoots = new CollectionResult<IInstallableUnit>(tmpRoots);
+
+ request = (ProfileChangeRequest) plan.createChangeRequest(prof);
+ Collection<IRequirement> limitingRequirements = new ArrayList<IRequirement>();
+
+ for (Iterator<IInstallableUnit> iterator = allRoots.query(QueryUtil.ALL_UNITS, null).iterator(); iterator.hasNext();) {
+ IInstallableUnit currentlyInstalled = iterator.next();
+
+ //find all the potential updates for the currentlyInstalled iu
+ IQueryResult<IInstallableUnit> updatesAvailable = plan.updatesFor(currentlyInstalled, context, null);
+ for (Iterator<IInstallableUnit> iterator2 = updatesAvailable.iterator(); iterator2.hasNext();) {
+ IInstallableUnit update = iterator2.next();
+ request.add(update);
+ request.setInstallableUnitInclusionRules(update, ProfileInclusionRules.createOptionalInclusionRule(update));
+ }
+ if (!updatesAvailable.isEmpty()) {
+ //force the original IU to optional, but make sure that the solution at least includes it
+ request.setInstallableUnitInclusionRules(currentlyInstalled, ProfileInclusionRules.createOptionalInclusionRule(currentlyInstalled));
+ limitingRequirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, currentlyInstalled.getId(), new VersionRange(currentlyInstalled.getVersion(), true, Version.MAX_VERSION, true), null, false, false));
+ }
+ }
+
+ IProvisioningPlan updateFinderPlan = plan.getProvisioningPlan(request, context, null);
+ if (updateFinderPlan.getAdditions().query(QueryUtil.ALL_UNITS, null).isEmpty()) {
+ return;
+ }
+
+ //Take into account all the removals
+ IProfileChangeRequest finalChangeRequest = plan.createChangeRequest(prof);
+ IQueryResult<IInstallableUnit> removals = updateFinderPlan.getRemovals().query(QueryUtil.ALL_UNITS, null);
+ for (Iterator<IInstallableUnit> iterator = removals.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ if (!allRoots.query(QueryUtil.createIUQuery(iu), null).isEmpty()) {
+ finalChangeRequest.remove(iu);
+ }
+ }
+
+ //Take into account the additions for stricts
+ for (Iterator<IInstallableUnit> iterator = strictRoots.iterator(); iterator.hasNext();) {
+ IInstallableUnit formerRoot = iterator.next();
+ IQueryResult<IInstallableUnit> update = updateFinderPlan.getAdditions().query(new UpdateQuery(formerRoot), null);
+ if (!update.isEmpty())
+ finalChangeRequest.addAll(update.toUnmodifiableSet());
+ }
+
+ //Take into account the additions for optionals
+ for (Iterator<IInstallableUnit> iterator = optionalRoots.iterator(); iterator.hasNext();) {
+ IInstallableUnit formerRoot = iterator.next();
+ IQueryResult<IInstallableUnit> update = updateFinderPlan.getAdditions().query(new UpdateQuery(formerRoot), null);
+ if (!update.isEmpty()) {
+ for (Iterator<IInstallableUnit> it = update.iterator(); it.hasNext();) {
+ IInstallableUnit updatedOptionalIU = it.next();
+ finalChangeRequest.add(updatedOptionalIU);
+ finalChangeRequest.setInstallableUnitInclusionRules(updatedOptionalIU, ProfileInclusionRules.createOptionalInclusionRule(updatedOptionalIU));
+ }
+ }
+ }
+ //return planner.getProvisioningPlan(finalChangeRequest, context, null);
+
+ }
+
+ // private IProvisioningPlan iFeelLucky(IProfile prof, IPlanner plan, ProvisioningContext context) {
+ // final String INCLUSION_RULES = "org.eclipse.equinox.p2.internal.inclusion.rules"; //$NON-NLS-1$
+ // final String INCLUSION_OPTIONAL = "OPTIONAL"; //$NON-NLS-1$
+ // final String INCLUSION_STRICT = "STRICT"; //$NON-NLS-1$
+ //
+ // IQueryResult<IInstallableUnit> strictRoots = prof.query(new IUProfilePropertyQuery(INCLUSION_RULES, INCLUSION_STRICT), null);
+ // IQueryResult<IInstallableUnit> optionalRoots = prof.query(new IUProfilePropertyQuery(INCLUSION_RULES, INCLUSION_OPTIONAL), null);
+ // Set<IInstallableUnit> tmpRoots = new HashSet<IInstallableUnit>(strictRoots.toUnmodifiableSet());
+ // tmpRoots.addAll(optionalRoots.toUnmodifiableSet());
+ // CollectionResult<IInstallableUnit> allRoots = new CollectionResult<IInstallableUnit>(tmpRoots);
+ //
+ // IProfileChangeRequest newRequest = plan.createChangeRequest(prof);
+ // Collection<IRequirement> limitingRequirements = new ArrayList<IRequirement>();
+ //
+ // for (Iterator<IInstallableUnit> iterator = allRoots.query(QueryUtil.ALL_UNITS, null).iterator(); iterator.hasNext();) {
+ // IInstallableUnit currentlyInstalled = iterator.next();
+ //
+ // //find all the potential updates for the currentlyInstalled iu
+ // IQueryResult<IInstallableUnit> updatesAvailable = plan.updatesFor(currentlyInstalled, context, null);
+ // for (Iterator<IInstallableUnit> iterator2 = updatesAvailable.iterator(); iterator2.hasNext();) {
+ // IInstallableUnit update = iterator2.next();
+ // newRequest.add(update);
+ // newRequest.setInstallableUnitInclusionRules(update, ProfileInclusionRules.createOptionalInclusionRule(update));
+ // }
+ // if (!updatesAvailable.isEmpty()) {
+ // //force the original IU to optional, but make sure that the solution at least includes it
+ // newRequest.setInstallableUnitInclusionRules(currentlyInstalled, ProfileInclusionRules.createOptionalInclusionRule(currentlyInstalled));
+ // limitingRequirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, currentlyInstalled.getId(), new VersionRange(currentlyInstalled.getVersion(), true, Version.MAX_VERSION, true), null, false, false));
+ // }
+ // }
+ //
+ // IProvisioningPlan updateFinderPlan = planner.getProvisioningPlan(newRequest, context, null);
+ // if (updateFinderPlan.getAdditions().query(QueryUtil.ALL_UNITS, null).isEmpty())
+ // return null;
+ //
+ // //Take into account all the removals
+ // IProfileChangeRequest finalChangeRequest = plan.createChangeRequest(prof);
+ // IQueryResult<IInstallableUnit> removals = updateFinderPlan.getRemovals().query(QueryUtil.ALL_UNITS, null);
+ // for (Iterator<IInstallableUnit> iterator = removals.iterator(); iterator.hasNext();) {
+ // IInstallableUnit iu = iterator.next();
+ // if (!allRoots.query(QueryUtil.createIUQuery(iu), null).isEmpty()) {
+ // finalChangeRequest.remove(iu);
+ // }
+ // }
+ //
+ // //Take into account the additions for stricts
+ // for (Iterator<IInstallableUnit> iterator = strictRoots.iterator(); iterator.hasNext();) {
+ // IInstallableUnit formerRoot = iterator.next();
+ // IQueryResult<IInstallableUnit> update = updateFinderPlan.getAdditions().query(new UpdateQuery(formerRoot), null);
+ // if (!update.isEmpty())
+ // finalChangeRequest.addAll(update.toUnmodifiableSet());
+ // }
+ //
+ // //Take into account the additions for optionals
+ // for (Iterator<IInstallableUnit> iterator = optionalRoots.iterator(); iterator.hasNext();) {
+ // IInstallableUnit formerRoot = iterator.next();
+ // IQueryResult<IInstallableUnit> update = updateFinderPlan.getAdditions().query(new UpdateQuery(formerRoot), null);
+ // if (!update.isEmpty()) {
+ // for (Iterator<IInstallableUnit> it = update.iterator(); it.hasNext();) {
+ // IInstallableUnit updatedOptionalIU = it.next();
+ // finalChangeRequest.add(updatedOptionalIU);
+ // finalChangeRequest.setInstallableUnitInclusionRules(updatedOptionalIU, ProfileInclusionRules.createOptionalInclusionRule(updatedOptionalIU));
+ // }
+ // }
+ // }
+ // return planner.getProvisioningPlan(finalChangeRequest, context, null);
+ // }
+
+ @Override
+ protected String getResolveJobName() {
+ return "Lucky Resolve Job";
+ }
+
+ @Override
+ protected String getProvisioningJobName() {
+ return "Lucky Provisioning Job";
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java
index b05ae81..d0067e0 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProfileChangeOperation.java
@@ -84,7 +84,7 @@ public abstract class ProfileChangeOperation implements IProfileChangeJob {
ProvisioningContext context;
MultiStatus noChangeRequest;
PlannerResolutionJob job;
- ProfileChangeRequest request;
+ protected ProfileChangeRequest request;
/**
* Create an operation using the provided provisioning session.
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
index 84f5e93..79becbe 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
@@ -137,7 +137,7 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
createSelectButtons(aboveSash);
// Details area
- iuDetailsGroup = new IUDetailsGroup(sashForm, availableIUGroup.getStructuredViewer(), SWT.DEFAULT, true);
+ iuDetailsGroup = new IUDetailsGroup(sashForm, availableIUGroup.getStructuredViewer(), SWT.DEFAULT, true, (ProvisioningOperationWizard) getWizard());
sashForm.setWeights(getSashWeights());
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
index bae73f2..c27cae5 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
@@ -19,6 +19,8 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.window.SameShellProvider;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
@@ -40,14 +42,18 @@ public class IUDetailsGroup {
private int widthHint;
private boolean scrollable;
private String lastText;
+ private Button retryButton = null;
+
+ private final ProvisioningOperationWizard wizard;
/**
*
*/
- public IUDetailsGroup(Composite parent, ISelectionProvider selectionProvider, int widthHint, boolean scrollable) {
+ public IUDetailsGroup(Composite parent, ISelectionProvider selectionProvider, int widthHint, boolean scrollable, ProvisioningOperationWizard wizard) {
this.selectionProvider = selectionProvider;
this.widthHint = widthHint;
this.scrollable = scrollable;
+ this.wizard = wizard;
createGroupComposite(parent);
}
@@ -88,6 +94,17 @@ public class IUDetailsGroup {
// set the initial state based on selection
propLink.setVisible(!selectionProvider.getSelection().isEmpty());
+ retryButton = new Button(detailsComposite, SWT.PUSH);
+ retryButton.setText("I'm feeling lucky...");
+ retryButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ System.out.println("Let's retry the operation");
+ // TODO, Let's do something different here.
+ wizard.recomputePlanWithLuck(wizard.getContainer());
+ System.out.println("Completed... the operation");
+ }
+ });
}
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 e1d12f6..ee6c65a 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
@@ -191,6 +191,37 @@ public abstract class ProvisioningOperationWizard extends Wizard {
return new ProvisioningContext(ui.getSession().getProvisioningAgent());
}
+ boolean youAreLucky = false;
+
+ public void recomputePlanWithLuck(IRunnableContext runnableContext) {
+
+ couldNotResolveStatus = Status.OK_STATUS;
+ provisioningContext = getProvisioningContext();
+ initializeResolutionModelElements(getOperationSelections());
+ if (planSelections.length == 0) {
+ operation = null;
+ couldNotResolve(ProvUIMessages.ResolutionWizardPage_NoSelections);
+ } else {
+ operation = ui.getLuckyOperation(provisioningContext);
+ operation.setProvisioningContext(provisioningContext);
+ try {
+ runnableContext.run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ operation.resolveModal(monitor);
+ }
+ });
+
+ } catch (InterruptedException e) {
+ // Nothing to report if thread was interrupted
+ } catch (InvocationTargetException e) {
+ ProvUI.handleException(e.getCause(), null, StatusManager.SHOW | StatusManager.LOG);
+ couldNotResolve(null);
+ }
+ }
+ planChanged();
+ youAreLucky = true;
+ }
+
/**
* Recompute the provisioning plan based on the items in the IUElementListRoot and the given provisioning context.
* Report progress using the specified runnable context. This method may be called before the page is created.
@@ -198,6 +229,10 @@ public abstract class ProvisioningOperationWizard extends Wizard {
* @param runnableContext
*/
public void recomputePlan(IRunnableContext runnableContext) {
+ if (youAreLucky) {
+ recomputePlanWithLuck(runnableContext);
+ return;
+ }
couldNotResolveStatus = Status.OK_STATUS;
provisioningContext = getProvisioningContext();
initializeResolutionModelElements(getOperationSelections());
@@ -350,4 +385,8 @@ public abstract class ProvisioningOperationWizard extends Wizard {
public boolean statusOverridesOperation() {
return false;
}
+
+ public void setBeLucky(boolean b) {
+ this.youAreLucky = b;
+ }
}
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 556f299..ef04c44 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
@@ -24,10 +24,13 @@ import org.eclipse.equinox.p2.operations.ProvisioningJob;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.statushandlers.StatusManager;
@@ -51,6 +54,7 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
protected Display display;
private IUDetailsGroup iuDetailsGroup;
SashForm sashForm;
+ Button relaxConstraints;
protected ResolutionResultsWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot input, ProfileChangeOperation operation) {
super("ResolutionPage", ui, wizard); //$NON-NLS-1$
@@ -111,12 +115,26 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
createSizingInfo(composite);
// The text area shows a description of the selected IU, or error detail if applicable.
- iuDetailsGroup = new IUDetailsGroup(sashForm, treeViewer, convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true);
+ iuDetailsGroup = new IUDetailsGroup(sashForm, treeViewer, convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true, (ProvisioningOperationWizard) getWizard());
setControl(sashForm);
sashForm.setWeights(getSashWeights());
Dialog.applyDialogFont(sashForm);
+ // Controls for filtering/presentation/site selection
+ Composite controlsComposite = new Composite(composite, SWT.NONE);
+ gridLayout = new GridLayout();
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.numColumns = 2;
+ gridLayout.makeColumnsEqualWidth = true;
+ gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ controlsComposite.setLayout(layout);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ controlsComposite.setLayoutData(gd);
+
+ createViewControlsArea(controlsComposite);
+
final Runnable runnable = new Runnable() {
public void run() {
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -124,7 +142,6 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
setDetailText(resolvedOperation);
}
});
- updateStatus(input, resolvedOperation);
setDrilldownElements(input, resolvedOperation);
treeViewer.setInput(input);
}
@@ -146,6 +163,18 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
}
}
+ private void createViewControlsArea(Composite controlsComposite) {
+ relaxConstraints = new Button(controlsComposite, SWT.CHECK);
+ relaxConstraints.setText("Relax constraints");
+ relaxConstraints.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ((ProvisioningOperationWizard) getWizard()).setBeLucky(relaxConstraints.getSelection());
+ setPageComplete(true);
+ }
+ });
+ }
+
protected void createSizingInfo(Composite parent) {
// Default is to do nothing
}
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 16dfec2..e126d08 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
@@ -27,6 +27,8 @@ import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
@@ -53,6 +55,7 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
protected Display display;
protected Policy policy;
SashForm sashForm;
+ Button relaxConstraints;
public SelectableIUsPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, Object[] initialSelections) {
super("IUSelectionPage", ui, wizard); //$NON-NLS-1$
@@ -147,8 +150,22 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
// Select and Deselect All buttons
createSelectButtons(composite);
+ // Controls for filtering/presentation/site selection
+ Composite controlsComposite = new Composite(composite, SWT.NONE);
+ gridLayout = new GridLayout();
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.numColumns = 2;
+ gridLayout.makeColumnsEqualWidth = true;
+ gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ controlsComposite.setLayout(layout);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ controlsComposite.setLayoutData(gd);
+
+ createViewControlsArea(controlsComposite);
+
// The text area shows a description of the selected IU, or error detail if applicable.
- iuDetailsGroup = new IUDetailsGroup(sashForm, tableViewer, convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true);
+ iuDetailsGroup = new IUDetailsGroup(sashForm, tableViewer, convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH), true, (ProvisioningOperationWizard) getWizard());
updateStatus(root, resolvedOperation);
setControl(sashForm);
@@ -156,6 +173,18 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
Dialog.applyDialogFont(sashForm);
}
+ private void createViewControlsArea(Composite controlsComposite) {
+ relaxConstraints = new Button(controlsComposite, SWT.CHECK);
+ relaxConstraints.setText("Relax constraints");
+ relaxConstraints.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ((ProvisioningOperationWizard) getWizard()).setBeLucky(relaxConstraints.getSelection());
+ setPageComplete(true);
+ }
+ });
+ }
+
private void createSelectButtons(Composite parent) {
Composite buttonParent = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
index 6b86256..d488fe9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
@@ -132,6 +132,13 @@ public class ProvisioningUI {
return profileId;
}
+ public LuckyOperation getLuckyOperation(ProvisioningContext context) {
+ LuckyOperation luckyOperation = new LuckyOperation(getSession());
+ luckyOperation.setProfileId(getProfileId());
+ luckyOperation.setProvisioningContext(context);
+ return luckyOperation;
+ }
+
/**
* Return an install operation that describes installing the specified IInstallableUnits from the
* provided list of repositories.