diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java new file mode 100644 index 000000000..c4e5ee4a6 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import org.eclipse.equinox.p2.metadata.IArtifactKey; + +import java.util.Map; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; + +public class Unconfigure extends InstallableUnitPhase { + + public Unconfigure(int weight, boolean forced) { + super(IPhaseSet.PHASE_UNCONFIGURE, weight, forced); + } + + public Unconfigure(int weight) { + this(weight, false); + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.first() != null); + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { + //TODO: monitor.subTask(NLS.bind(Messages.Engine_Unconfiguring_IU, unit.getId())); + + IInstallableUnit unit = currentOperand.first(); + if (unit.isFragment()) + return null; + + return getActions(unit, phaseId); + } + + protected String getProblemMessage() { + return Messages.Phase_Unconfigure_Error; + } + + protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { + IInstallableUnit iu = operand.first(); + parameters.put(PARM_IU, iu); + + IArtifactKey[] artifacts = iu.getArtifacts(); + if (artifacts != null && artifacts.length > 0) + parameters.put(PARM_ARTIFACT, artifacts[0]); + + return Status.OK_STATUS; + } +} |