diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java index 744b266bb..fb27f1197 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java @@ -11,6 +11,7 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions; import java.io.File; +import java.util.Collection; import java.util.Map; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -18,16 +19,18 @@ import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util; import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo; import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator; -import org.eclipse.equinox.internal.provisional.p2.engine.IProfile; -import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction; -import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.osgi.util.NLS; public class MarkStartedAction extends ProvisioningAction { public static final String ID = "markStarted"; //$NON-NLS-1$ - public IStatus execute(Map parameters) { + public IStatus execute(Map<String, Object> parameters) { + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT); IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); @@ -35,14 +38,14 @@ public class MarkStartedAction extends ProvisioningAction { if (started == null) return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_STARTED, ID)); - IArtifactKey[] artifacts = iu.getArtifacts(); - if (artifacts == null || artifacts.length == 0) + Collection<IArtifactKey> artifacts = iu.getArtifacts(); + if (artifacts == null || artifacts.isEmpty()) return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu)); - IArtifactKey artifactKey = artifacts[0]; + IArtifactKey artifactKey = artifacts.iterator().next(); // the bundleFile might be null here, that's OK. - File bundleFile = Util.getArtifactFile(artifactKey, profile); + File bundleFile = Util.getArtifactFile(agent, artifactKey, profile); String manifest = Util.getManifest(iu.getTouchpointData()); if (manifest == null) @@ -66,7 +69,8 @@ public class MarkStartedAction extends ProvisioningAction { return Status.OK_STATUS; } - public IStatus undo(Map parameters) { + public IStatus undo(Map<String, Object> parameters) { + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(ActionConstants.PARM_AGENT); Boolean previousStarted = (Boolean) getMemento().get(ActionConstants.PARM_PREVIOUS_STARTED); if (previousStarted == null) return Status.OK_STATUS; @@ -75,13 +79,13 @@ public class MarkStartedAction extends ProvisioningAction { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); - IArtifactKey[] artifacts = iu.getArtifacts(); - if (artifacts == null || artifacts.length == 0) + Collection<IArtifactKey> artifacts = iu.getArtifacts(); + if (artifacts == null || artifacts.isEmpty()) return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu)); - IArtifactKey artifactKey = artifacts[0]; + IArtifactKey artifactKey = artifacts.iterator().next(); // the bundleFile might be null here, that's OK. - File bundleFile = Util.getArtifactFile(artifactKey, profile); + File bundleFile = Util.getArtifactFile(agent, artifactKey, profile); String manifest = Util.getManifest(iu.getTouchpointData()); if (manifest == null) |