aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Pontes2011-09-26 16:50:52 (EDT)
committerOtavio Pontes2011-11-09 13:58:42 (EST)
commitf0edddf0ad9cddfb4229b7915fa79d5f70149691 (patch)
tree8247cdbed918486416b3ca315525c1471169cc47
parent9745c96f06cdae797a0fd2baca5ef893207adff3 (diff)
downloadorg.eclipse.linuxtools-f0edddf0ad9cddfb4229b7915fa79d5f70149691.zip
org.eclipse.linuxtools-f0edddf0ad9cddfb4229b7915fa79d5f70149691.tar.gz
org.eclipse.linuxtools-f0edddf0ad9cddfb4229b7915fa79d5f70149691.tar.bz2
Creating a plugin to add Factories to run commands. (Bug #353056)
The factories from this plugin should use the Linuxtools location defined in the project properties
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/.classpath7
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/.project28
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/META-INF/MANIFEST.MF16
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/about.html28
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/build.properties5
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/plugin.properties12
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/pom.xml44
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/Activator.java44
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/CdtSpawnerProcessFactory.java73
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/LinuxtoolsProcessFactory.java82
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java94
-rw-r--r--profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java34
-rw-r--r--profiling/pom.xml1
14 files changed, 476 insertions, 0 deletions
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/.classpath b/profiling/org.eclipse.linuxtools.tools.launch.core/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/.project b/profiling/org.eclipse.linuxtools.tools.launch.core/.project
new file mode 100644
index 0000000..0fc4eb5
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.tools.launch.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/.settings/org.eclipse.jdt.core.prefs b/profiling/org.eclipse.linuxtools.tools.launch.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..93bbd7c
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Sep 26 15:12:57 BRT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/META-INF/MANIFEST.MF b/profiling/org.eclipse.linuxtools.tools.launch.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b1fe24e
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.tools.launch.core
+Bundle-Version: 0.8.0.qualifier
+Bundle-Vendor: %provider
+Bundle-Activator: org.eclipse.linuxtools.tools.launch.core.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.cdt.core,
+ org.eclipse.core.resources,
+ org.eclipse.ui;bundle-version="3.7.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.linuxtools.tools.launch.core.factory,
+ org.eclipse.linuxtools.tools.launch.core.properties
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/about.html b/profiling/org.eclipse.linuxtools.tools.launch.core/about.html
new file mode 100644
index 0000000..c258ef5
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/build.properties b/profiling/org.eclipse.linuxtools.tools.launch.core/build.properties
new file mode 100644
index 0000000..4d2c734
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.properties,\
+ .
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/plugin.properties b/profiling/org.eclipse.linuxtools.tools.launch.core/plugin.properties
new file mode 100644
index 0000000..860d6d3
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2011 IBM Corporation
+# 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:
+# Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+#################################################################################
+bundleName=Tools Launcher Core (Incubation)
+provider=Eclipse Linux Tools
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/pom.xml b/profiling/org.eclipse.linuxtools.tools.launch.core/pom.xml
new file mode 100644
index 0000000..ed27abd
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, IBM Corporation
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>linuxtools-profiling-parent</artifactId>
+ <groupId>org.eclipse.linuxtools.profiling</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.linuxtools.tools.launch.core</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <name>Linux Tools Tools Launcher Core Plug-in</name>
+
+ <build>
+ <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 -->
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/Activator.java b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/Activator.java
new file mode 100644
index 0000000..91da7e0
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/Activator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation
+ * 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.core;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.tools.launch.core"; //$NON-NLS-1$
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/CdtSpawnerProcessFactory.java b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/CdtSpawnerProcessFactory.java
new file mode 100644
index 0000000..9282379
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/CdtSpawnerProcessFactory.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation
+ * 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.core.factory;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+import org.eclipse.core.resources.IProject;
+
+/*
+ * Create process using org.eclipse.cdt.utils.spawner.ProcessFactory and
+ * prepends the 'Linux tools path' project property to the environment
+ * PATH.
+ * Use this factory instead of Cdt ProcessFactory if the command you are
+ * running may be in the linux tools path selected in the project property
+ * page.
+ */
+public class CdtSpawnerProcessFactory extends LinuxtoolsProcessFactory {
+ private static CdtSpawnerProcessFactory instance = null;
+
+ public static CdtSpawnerProcessFactory getFactory() {
+ if (instance == null)
+ instance = new CdtSpawnerProcessFactory();
+ return instance;
+ }
+
+ public Process exec(String cmd, IProject project) throws IOException {
+ return exec(cmd, null, project);
+ }
+
+ public Process exec(String[] cmdarray, IProject project) throws IOException {
+ return exec(cmdarray, null, project);
+ }
+
+ public Process exec(String[] cmdarray, String[] envp, IProject project) throws IOException {
+ envp = updateEnvironment(envp, project);
+ return ProcessFactory.getFactory().exec(cmdarray, envp);
+ }
+
+ public Process exec(String cmd, String[] envp, IProject project) throws IOException {
+ envp = updateEnvironment(envp, project);
+ return ProcessFactory.getFactory().exec(cmd, envp);
+ }
+
+ public Process exec(String cmd, String[] envp, File dir, IProject project)
+ throws IOException {
+ envp = updateEnvironment(envp, project);
+ return ProcessFactory.getFactory().exec(cmd, envp, dir);
+ }
+
+ public Process exec(String cmdarray[], String[] envp, File dir, IProject project)
+ throws IOException {
+ envp = updateEnvironment(envp, project);
+ return ProcessFactory.getFactory().exec(cmdarray, envp, dir);
+ }
+
+ public Process exec(String cmdarray[], String[] envp, File dir, PTY pty, IProject project)
+ throws IOException {
+ envp = updateEnvironment(envp, project);
+ return ProcessFactory.getFactory().exec(cmdarray, envp, dir, pty);
+ }
+}
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/LinuxtoolsProcessFactory.java b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/LinuxtoolsProcessFactory.java
new file mode 100644
index 0000000..5e277fe
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/LinuxtoolsProcessFactory.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation
+ * 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.core.factory;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.linuxtools.tools.launch.core.properties.LinuxtoolsPathProperty;
+
+/*
+ * Abstract class with usefull functions for ProcessFactory classes.
+ */
+public abstract class LinuxtoolsProcessFactory {
+ private static final String PATH = "PATH"; //$NON-NLS-1$
+ private static final String PATH_EQUAL = "PATH="; //$NON-NLS-1$
+ private static final String SEPARATOR = ":"; //$NON-NLS-1$
+
+ private String getEnvpPath(String[] envp) {
+ for (String env:envp)
+ if (env.startsWith(PATH_EQUAL))
+ return env.substring(PATH_EQUAL.length());
+ return null;
+ }
+
+ /*
+ * Update the environment variables list with the Linux tools path project
+ * property, prepending it to the PATH env. Call this function if the
+ * command to be run may be in the path selected in 'Linux tools path'
+ * project property page.
+ * */
+ protected String[] updateEnvironment(String[] envp, IProject project) {
+ if (project == null)
+ return envp;
+ if (envp == null)
+ envp = new String[0];
+ String ltPath = LinuxtoolsPathProperty.getLinuxtoolsPath(project);
+ String envpPath = getEnvpPath(envp);
+ String systemPath = System.getenv(PATH);
+ StringBuffer newPath = new StringBuffer();
+ newPath.append(PATH_EQUAL);
+
+ if (ltPath != null && ltPath.length() > 0) {
+ newPath.append(ltPath);
+ newPath.append(SEPARATOR);
+ }
+ if (envpPath != null && envpPath.length() > 0) {
+ newPath.append(envpPath);
+ newPath.append(SEPARATOR);
+ }
+ if (systemPath != null && systemPath.length() > 0) {
+ newPath.append(systemPath);
+ newPath.append(SEPARATOR);
+ }
+
+ if (newPath.length() == PATH_EQUAL.length())
+ //there is nothing to add
+ return envp;
+
+ String[] newEnvp;
+ if (envpPath != null) {
+ newEnvp = new String[envp.length];
+ for (int i = 0; i < envp.length; i++)
+ if (envp[i].startsWith(PATH_EQUAL))
+ newEnvp[i] = newPath.toString();
+ else
+ newEnvp[i] = envp[i];
+ } else {
+ newEnvp = new String[envp.length + 1];
+ for (int i = 0; i < envp.length; i++)
+ newEnvp[i] = envp[i];
+ newEnvp[envp.length] = newPath.toString();
+ }
+ return newEnvp;
+ }
+}
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java
new file mode 100644
index 0000000..29c8c6b
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/factory/RuntimeProcessFactory.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation
+ * 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.core.factory;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IProject;
+
+/*
+ * Create process using Runtime.getRuntime().exec and prepends the
+ * 'Linux tools path' project property to the environment PATH.
+ * Use this factory instead of Runtime.getRuntime().exec if the command you
+ * are running may be in the linux tools path selected in the project property
+ * page.
+ */
+public class RuntimeProcessFactory extends LinuxtoolsProcessFactory {
+ private static RuntimeProcessFactory instance = null;
+ private static final String WHICH_CMD = "which"; //$NON-NLS-1$
+
+ private String[] tokenizeCommand(String command) {
+ StringTokenizer tokenizer = new StringTokenizer(command);
+ String[] cmdarray = new String[tokenizer.countTokens()];
+ for (int i = 0; tokenizer.hasMoreElements(); i++)
+ cmdarray[i] = tokenizer.nextToken();
+
+ return cmdarray;
+ }
+
+ private String[] fillPathCommand(String[] cmdarray, String[] envp) throws IOException {
+ Process p = Runtime.getRuntime().exec(new String[] {WHICH_CMD, cmdarray[0]}, envp);
+
+ try {
+ if (p.waitFor() == 0) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ cmdarray[0] = reader.readLine();
+ } else {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ throw new IOException(reader.readLine());
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ return cmdarray;
+ }
+
+ public static RuntimeProcessFactory getFactory() {
+ if (instance == null)
+ instance = new RuntimeProcessFactory();
+ return instance;
+ }
+
+ public Process exec(String cmd, IProject project) throws IOException {
+ return exec(cmd, null, null, project);
+ }
+
+ public Process exec(String[] cmdarray, IProject project) throws IOException {
+ return exec(cmdarray, null, project);
+ }
+
+ public Process exec(String[] cmdarray, String[] envp, IProject project) throws IOException {
+ return exec(cmdarray, envp, null, project);
+ }
+
+ public Process exec(String cmd, String[] envp, IProject project) throws IOException {
+ return exec(cmd, envp, null, project);
+ }
+
+ public Process exec(String cmd, String[] envp, File dir, IProject project)
+ throws IOException {
+ return exec(tokenizeCommand(cmd), envp, dir, project);
+ }
+
+ public Process exec(String cmdarray[], String[] envp, File dir, IProject project)
+ throws IOException {
+ envp = updateEnvironment(envp, project);
+ cmdarray = fillPathCommand(cmdarray, envp);
+
+ return Runtime.getRuntime().exec(cmdarray, envp, dir);
+ }
+}
diff --git a/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java
new file mode 100644
index 0000000..335cbf5
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.tools.launch.core/src/org/eclipse/linuxtools/tools/launch/core/properties/LinuxtoolsPathProperty.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation
+ * 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:
+ * Otavio Busatto Pontes <obusatto@br.ibm.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tools.launch.core.properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.linuxtools.tools.launch.core.Activator;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+public class LinuxtoolsPathProperty {
+ public static final String LINUXTOOLS_PATH_NAME = Activator.PLUGIN_ID + ".LinuxtoolsPath"; //$NON-NLS-1$
+ public static final String LINUXTOOLS_PATH_DEFAULT = ""; //$NON-NLS-1$
+ public static String getLinuxtoolsPath(IProject project) {
+ if (project == null)
+ return null;
+
+ ScopedPreferenceStore store = new ScopedPreferenceStore(
+ new ProjectScope(project),
+ Activator.PLUGIN_ID);
+ String path = store.getString(LINUXTOOLS_PATH_NAME);
+ if (path == null || path.equals(""))
+ return LINUXTOOLS_PATH_DEFAULT;
+ return path;
+ }
+}
diff --git a/profiling/pom.xml b/profiling/pom.xml
index b4fd862..1d8c5fb 100644
--- a/profiling/pom.xml
+++ b/profiling/pom.xml
@@ -58,6 +58,7 @@
</build>
<modules>
+ <module>org.eclipse.linuxtools.tools.launch.core</module>
<module>org.eclipse.linuxtools.binutils</module>
<module>org.eclipse.linuxtools.dataviewers</module>
<module>org.eclipse.linuxtools.dataviewers.charts</module>