Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2008-04-09 20:27:26 +0000
committerAndrew Niefer2008-04-09 20:27:26 +0000
commit10ed64307df5a27e1fd13418a64d54dda239b626 (patch)
tree2f119a48d446327f47efe37c5a037af9f3889741 /bundles/org.eclipse.equinox.p2.touchpoint.eclipse
parent82d628e7b87d48a7b658e883fc1bbbd6349c1fc8 (diff)
downloadrt.equinox.p2-10ed64307df5a27e1fd13418a64d54dda239b626.tar.gz
rt.equinox.p2-10ed64307df5a27e1fd13418a64d54dda239b626.tar.xz
rt.equinox.p2-10ed64307df5a27e1fd13418a64d54dda239b626.zip
bug 221710, bug 222621, chmod & ln on plugins and rootfiles
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse')
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java42
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java62
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java65
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java41
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties1
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties1
11 files changed, 176 insertions, 63 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java
index 4e1c10c61..e7caf3bad 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Messages.java
@@ -26,6 +26,7 @@ public class Messages extends NLS {
public static String error_parsing_configuration;
public static String generator_not_available;
public static String artifact_file_not_found;
+ public static String iu_contains_no_arifacts;
public static String artifact_retrieval_unsupported;
public static String bundle_pool_not_writeable;
public static String cannot_calculate_extension_location;
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
index f335a4b40..5c6cc09e3 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java
@@ -18,14 +18,14 @@ import java.net.URL;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.*;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.ActionConstants;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.internal.provisional.p2.metadata.TouchpointData;
+import org.eclipse.equinox.internal.provisional.p2.metadata.*;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.osgi.util.NLS;
@@ -242,4 +242,18 @@ public class Util {
return new Status(IStatus.ERROR, Activator.ID, message, e);
}
+ public static String resolveArtifactParam(Map parameters) throws CoreException {
+ IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
+ IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
+ IArtifactKey[] artifacts = iu.getArtifacts();
+ if (artifacts == null || artifacts.length == 0)
+ throw new CoreException(createError(NLS.bind(Messages.iu_contains_no_arifacts, iu)));
+
+ IArtifactKey artifactKey = artifacts[0];
+
+ File fileLocation = Util.getArtifactFile(artifactKey, profile);
+ if (fileLocation == null || !fileLocation.exists())
+ throw new CoreException(createError(NLS.bind(Messages.artifact_file_not_found, artifactKey)));
+ return fileLocation.getAbsolutePath();
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
index d89861bbf..0ebd72600 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionConstants.java
@@ -30,5 +30,10 @@ public class ActionConstants {
public static final String PARM_DEFAULT_VALUE = "default"; //$NON-NLS-1$
public static final String PARM_LAUNCHERNAME = "name"; //$NON-NLS-1$
public static final String PARM_PATH = "path"; //$NON-NLS-1$
+ public static final String PARM_TARGET_DIR = "targetDir"; //$NON-NLS-1$
+ public static final String PARM_LINK_NAME = "linkName"; //$NON-NLS-1$
+ public static final String PARM_LINK_TARGET = "linkTarget"; //$NON-NLS-1$
+ public static final String PARM_TARGET_FILE = "targetFile"; //$NON-NLS-1$
+ public static final String PARM_PERMISSIONS = "permissions"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java
index 07c6fb886..102d4a49f 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ActionFactory.java
@@ -40,6 +40,8 @@ public class ActionFactory {
actions.put(RemoveJVMArgumentAction.ID, RemoveJVMArgumentAction.class);
actions.put(MkdirAction.ID, MkdirAction.class);
actions.put(RmdirAction.ID, RmdirAction.class);
+ actions.put(LinkAction.ID, LinkAction.class);
+ actions.put(ChmodAction.ID, ChmodAction.class);
}
public static ProvisioningAction create(String actionId) {
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
index 27f9bcc3a..623b03db5 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddProgramArgumentAction.java
@@ -8,17 +8,12 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
-import java.io.File;
import java.util.Map;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
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.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.osgi.util.NLS;
public class AddProgramArgumentAction extends ProvisioningAction {
@@ -31,19 +26,11 @@ public class AddProgramArgumentAction extends ProvisioningAction {
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
-
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getArtifactFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
- programArg = fileLocation.getAbsolutePath();
+ try {
+ programArg = Util.resolveArtifactParam(parameters);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
}
manipulator.getLauncherData().addProgramArg(programArg);
@@ -57,18 +44,11 @@ public class AddProgramArgumentAction extends ProvisioningAction {
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getArtifactFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
- programArg = fileLocation.getAbsolutePath();
+ try {
+ programArg = Util.resolveArtifactParam(parameters);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
}
manipulator.getLauncherData().removeProgramArg(programArg);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java
new file mode 100644
index 000000000..8b868555a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/ChmodAction.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class ChmodAction extends ProvisioningAction {
+ public static final String ID = "chmod"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
+ if (targetDir == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_DIR, ID));
+ if (targetDir.equals(ActionConstants.PARM_ARTIFACT)) {
+ try {
+ targetDir = Util.resolveArtifactParam(parameters);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ File dir = new File(targetDir);
+ if (!dir.isDirectory()) {
+ return Util.createError(NLS.bind(Messages.artifact_not_directory, dir));
+ }
+ }
+ String targetFile = (String) parameters.get(ActionConstants.PARM_TARGET_FILE);
+ if (targetFile == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_FILE, ID));
+
+ String permissions = (String) parameters.get(ActionConstants.PARM_PERMISSIONS);
+ if (permissions == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PERMISSIONS, ID));
+
+ chmod(targetDir, targetFile, permissions);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ //TODO: implement undo ??
+ return Status.OK_STATUS;
+ }
+
+ private void chmod(String targetDir, String targetFile, String perms) {
+ Runtime r = Runtime.getRuntime();
+ try {
+ r.exec(new String[] {"chmod", perms, targetDir + IPath.SEPARATOR + targetFile}); //$NON-NLS-1$
+ } catch (IOException e) {
+ // FIXME: we should probably throw some sort of error here
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
new file mode 100644
index 000000000..ec09404d5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/LinkAction.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.touchpoint.eclipse.actions;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class LinkAction extends ProvisioningAction {
+ public static final String ID = "ln"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ String targetDir = (String) parameters.get(ActionConstants.PARM_TARGET_DIR);
+ if (targetDir == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_TARGET_DIR, ID));
+
+ if (targetDir.equals(ActionConstants.PARM_ARTIFACT)) {
+ try {
+ targetDir = Util.resolveArtifactParam(parameters);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ File dir = new File(targetDir);
+ if (!dir.isDirectory()) {
+ return Util.createError(NLS.bind(Messages.artifact_not_directory, dir));
+ }
+ }
+
+ String linkTarget = (String) parameters.get(ActionConstants.PARM_LINK_TARGET);
+ if (linkTarget == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_LINK_TARGET, ID));
+
+ String linkName = (String) parameters.get(ActionConstants.PARM_LINK_NAME);
+ if (linkName == null)
+ return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_LINK_NAME, ID));
+
+ ln(targetDir, linkTarget, linkName);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private void ln(String targetDir, String linkTarget, String linkName) {
+ Runtime r = Runtime.getRuntime();
+ try {
+ r.exec(new String[] {"ln", "-s", linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java
index dbeb1e7d9..c7bd48e9e 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/Messages.java
@@ -23,6 +23,7 @@ public class Messages extends NLS {
public static String failed_bundleinfo;
public static String cannot_configure_source_bundle;
public static String error_parsing_startlevel;
+ public static String artifact_not_directory;
static {
// load message values from bundle file and assign to fields below
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
index 7f939338a..1f1234135 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveProgramArgumentAction.java
@@ -8,17 +8,12 @@
******************************************************************************/
package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;
-import java.io.File;
import java.util.Map;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
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.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.osgi.util.NLS;
public class RemoveProgramArgumentAction extends ProvisioningAction {
@@ -31,18 +26,11 @@ public class RemoveProgramArgumentAction extends ProvisioningAction {
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getArtifactFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
- programArg = fileLocation.getAbsolutePath();
+ try {
+ programArg = Util.resolveArtifactParam(parameters);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
}
manipulator.getLauncherData().removeProgramArg(programArg);
@@ -56,18 +44,11 @@ public class RemoveProgramArgumentAction extends ProvisioningAction {
return Util.createError(NLS.bind(Messages.parameter_not_set, ActionConstants.PARM_PROGRAM_ARG, ID));
if (programArg.equals(ActionConstants.PARM_ARTIFACT)) {
- IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE);
- IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU);
- IArtifactKey[] artifacts = iu.getArtifacts();
- if (artifacts == null || artifacts.length == 0)
- return Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu));
-
- IArtifactKey artifactKey = artifacts[0];
-
- File fileLocation = Util.getArtifactFile(artifactKey, profile);
- if (fileLocation == null || !fileLocation.exists())
- return Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey));
- programArg = fileLocation.getAbsolutePath();
+ try {
+ programArg = Util.resolveArtifactParam(parameters);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
}
manipulator.getLauncherData().addProgramArg(programArg);
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties
index f8551dea0..113cecbf5 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/messages.properties
@@ -10,6 +10,7 @@
###############################################################################
artifact_file_not_found=The artifact file for {0} was not found.
+artifact_not_directory=The artifact {0} is not a directory.
action_not_instantiated=Action could not be instantiated for action id: {0}.
parameter_not_set=The \"{0}\" parameter was not set in the \"{1}\" action.
iu_contains_no_arifacts=Installable unit contains no artifacts: {0}.
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties
index 8e0987606..bbc7211c8 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/messages.properties
@@ -20,6 +20,7 @@ error_constructing_platform_configuration_url=Error constructing platform config
error_parsing_configuration=Error parsing platform configuration.
generator_not_available=The partial IU could not be updated. Generator not available: {0}.
artifact_file_not_found=The artifact file for {0} was not found.
+iu_contains_no_arifacts=Installable unit contains no artifacts: {0}.
artifact_retrieval_unsupported=Repository does not support artifact retrieval
bundle_pool_not_writeable=Bundle pool repository not writeable: {0}
BundlePool=Bundle pool

Back to the top