Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2013-03-07 22:22:13 +0000
committerCamilo Bernal2013-03-08 17:23:23 +0000
commit303efa3e5882222edafdda12565317893e4e4680 (patch)
treedcec07b65b19c84461f2847d4f106cf5f1ba5625 /profiling
parentd69ce50b5e5aa7888d95cfc7fb3b53986353d8ef (diff)
downloadorg.eclipse.linuxtools-303efa3e5882222edafdda12565317893e4e4680.tar.gz
org.eclipse.linuxtools-303efa3e5882222edafdda12565317893e4e4680.tar.xz
org.eclipse.linuxtools-303efa3e5882222edafdda12565317893e4e4680.zip
Clean up ProfileLaunchConfigurationDelegate.
Remove methods from ProfileLaunchConfigurationDelegate that are only used by the Callgraph plugin and move them to the plugin itself. Change-Id: I3268b87c0b44cf4f53660e856224713e52de378a Reviewed-on: https://git.eclipse.org/r/10982 Tested-by: Hudson CI Reviewed-by: Camilo Bernal <cabernal@redhat.com> IP-Clean: Camilo Bernal <cabernal@redhat.com> Tested-by: Camilo Bernal <cabernal@redhat.com>
Diffstat (limited to 'profiling')
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/provider/launch/ProviderLaunchConfigurationDelegate.java5
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java138
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.provider.tests/src/org/eclipse/linuxtools/profiling/provider/tests/stubby/StubbyLaunchConfigurationDelegate.java5
3 files changed, 0 insertions, 148 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/provider/launch/ProviderLaunchConfigurationDelegate.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/provider/launch/ProviderLaunchConfigurationDelegate.java
index 4741e3f20f..e2b8e6c3d3 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/provider/launch/ProviderLaunchConfigurationDelegate.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/provider/launch/ProviderLaunchConfigurationDelegate.java
@@ -106,11 +106,6 @@ public class ProviderLaunchConfigurationDelegate extends
}
@Override
- public String generateCommand(ILaunchConfiguration config) {
- return null;
- }
-
- @Override
protected String getPluginID() {
return ProviderProfileConstants.PLUGIN_ID;
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java
index f483f7ecf4..81a287a25d 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileLaunchConfigurationDelegate.java
@@ -11,21 +11,14 @@
package org.eclipse.linuxtools.profiling.launch;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.util.ArrayList;
import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.TextConsole;
/**
* Helper class for launching command line tools. Contains methods for creating a process and
@@ -37,98 +30,7 @@ import org.eclipse.ui.console.TextConsole;
*/
public abstract class ProfileLaunchConfigurationDelegate extends AbstractCLaunchDelegate{
- /**
- * Deletes and recreates the file at outputPath
- *
- * @param outputPath
- * @return false if there is an IOException
- */
- protected boolean testOutput(String outputPath) {
- try {
- //Make sure the output file exists
- File tempFile = new File(outputPath);
- tempFile.delete();
- tempFile.createNewFile();
- } catch (IOException e1) {
- return false;
- }
- return true;
- }
-
- /**
- * This method will create a process in the command line with I/O directed to the Eclipse console.
- * It returns a reference to the process. Note that the process runs independently of Eclipse's threads,
- * so you will have to poll the process to determine when it has terminated. To grab output from the
- * process, either attach a <code>org.eclipse.debug.core.model.IStreamMonitor</code> to one of the monitors
- * in <code>process.getStreamsProxy()</code>, or use the static get methods in
- * <code>ProfileLaunchConfigurationDelegate</code>.
- *
- * <br>
- * Will call generateCommand(config) to create the command line.
- *
- *
- * @param config -- Use the configuration passed as a parameter to the launch method.
- * @param cmd -- Command string, as it would appear on the command line.
- * @param launch -- use the launch passed as a parameter to the launch method.
- * @return
- * @throws CoreException
- * @throws IOException
- */
-
- protected IProcess createProcess(ILaunchConfiguration config, ILaunch launch) throws CoreException, IOException {
- File workDir = getWorkingDirectory(config);
- if (workDir == null) {
- workDir = new File(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- //Put command into a shell script
- String cmd = generateCommand(config);
- File script = File.createTempFile("org.eclipse.linuxtools.profiling.launch" + System.currentTimeMillis(), ".sh");
- String data = "#!/bin/sh\nexec " + cmd; //$NON-NLS-1$
- FileOutputStream out = null;
- try {
- out = new FileOutputStream(script);
- out.write(data.getBytes());
- } finally {
- if (out != null) {
- out.close();
- }
- }
-
- String[] commandArray = prepareCommand("sh " + script.getAbsolutePath());
- Process subProcess = execute(commandArray, getEnvironment(config),
- workDir, true);
-
- IProcess process = createNewProcess(launch, subProcess,commandArray[0]);
- // set the command line used
- process.setAttribute(IProcess.ATTR_CMDLINE,cmd);
-
- return process;
- }
-
- /**
- * Use to generate the command.
- * @param config
- * @return The command string, as it would appear on command-line
- */
- public abstract String generateCommand(ILaunchConfiguration config);
-
- /**
- * Prepare cmd for execution - we need a command array of strings,
- * no string can contain a space character. The resulting command
- * array will be passed in to the process.
- */
- protected String[] prepareCommand(String cmd) {
- String tmp[] = cmd.split(" "); //$NON-NLS-1$
- ArrayList<String> cmdLine = new ArrayList<String>();
- for (String str : tmp) {
- cmdLine.add(str);
- }
- return cmdLine.toArray(new String[cmdLine.size()]);
- }
-
-
/**
* Executes a command array using pty
*
@@ -174,45 +76,5 @@ public abstract class ProfileLaunchConfigurationDelegate extends AbstractCLaunch
return DebugPlugin.newProcess(launch, systemProcess,
renderProcessLabel(programName));
}
-
-
- /**
- *
- * @param search : A String that can be found in the console
- * @return The TextConsole having 'name' somewhere within it's name
- */
- public static TextConsole getConsole(String search) {
- for (int i = 0; i < ConsolePlugin.getDefault().getConsoleManager()
- .getConsoles().length; i++) {
- if (ConsolePlugin.getDefault().getConsoleManager().
- getConsoles()[i].getName().contains(search)) {
- return (TextConsole)ConsolePlugin.getDefault().getConsoleManager().getConsoles()[i];
- }
- }
- return null;
- }
-
-
- /**
- * Returns the contents of a console as a String
- *
- * @param search : Console name
- * @return The text contained within that console
- */
- public static String getMainConsoleText(String search){
- TextConsole proc = getConsole(search);
- return proc.getDocument().get();
- }
-
- /**
- * Return the document attached to containing the given string. For best results,
- * use <code>ILaunchConfiguration.getName()</code>.
- * @param search
- * @return
- */
- public static IDocument getConsoleDocument(String search) {
- return getConsole(search).getDocument();
- }
-
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.provider.tests/src/org/eclipse/linuxtools/profiling/provider/tests/stubby/StubbyLaunchConfigurationDelegate.java b/profiling/org.eclipse.linuxtools.profiling.provider.tests/src/org/eclipse/linuxtools/profiling/provider/tests/stubby/StubbyLaunchConfigurationDelegate.java
index c6e380c77b..077a58b514 100644
--- a/profiling/org.eclipse.linuxtools.profiling.provider.tests/src/org/eclipse/linuxtools/profiling/provider/tests/stubby/StubbyLaunchConfigurationDelegate.java
+++ b/profiling/org.eclipse.linuxtools.profiling.provider.tests/src/org/eclipse/linuxtools/profiling/provider/tests/stubby/StubbyLaunchConfigurationDelegate.java
@@ -19,11 +19,6 @@ public class StubbyLaunchConfigurationDelegate extends
ProfileLaunchConfigurationDelegate {
@Override
- public String generateCommand(ILaunchConfiguration config) {
- return null;
- }
-
- @Override
public void launch(ILaunchConfiguration configuration, String mode,
ILaunch launch, IProgressMonitor monitor) {
}

Back to the top

an>Andrey Loskutov14-21/+21 2017-05-15Bug 516644 - [regression] Unit test for NPE inI20170515-2000Sebastian Ratz3-1/+68 2017-05-15Bug 516644 - [regression] NPE inI20170515-0910Sebastian Ratz1-1/+5 2017-05-05Bug 450530 - [team] NPE in ResourceModelContentProvider.getTraversalsY20170512-0230Y20170511-1500Y20170511-1000S4_7_0_M7I20170515-0800I20170514-2000I20170514-1120I20170512-0500I20170511-1200I20170510-2000I20170510-0800I20170509-2000I20170509-1300I20170509-1100I20170509-0945I20170509-0800I20170508-2000I20170508-0800I20170507-2000I20170506-2000I20170505-2000Andrey Loskutov1-1/+6 2017-05-05Bug 450530 - [team] NPE in ResourceModelContentProvider.getTraversalsAndrey Loskutov1-43/+16 2017-05-05Bug 516228 - Preference dialog of synchronize view shows missing image iconRĂ¼diger Herrmann1-2/+3 2017-05-03Bug 516077 - Cleanup o.e.core.netY20170504-1000I20170504-2000I20170503-2000Alexander Kurtakov17-109/+168 2017-05-02Bug 516068 - Cleanup o.e.core.tests.net I20170502-2000Alexander Kurtakov5-111/+74 2017-04-04Bug 509893 - ResourceModelContentProvider.propertyChanged should not useY20170427-1000Y20170420-1000Y20170413-1000Y20170406-1000I20170501-2000I20170430-2000I20170429-2000I20170429-1330I20170429-1230I20170428-2000I20170428-0830I20170428-0700I20170428-0550I20170428-0445I20170427-2000I20170426-2000I20170425-2000I20170425-0910I20170425-0700I20170425-0240I20170425-0215I20170424-2000I20170423-2000I20170422-2000I20170422-0300I20170421-2000I20170420-2000I20170419-2000I20170419-0430I20170419-0130I20170418-2000I20170417-2000I20170416-2000I20170415-2000I20170414-2000I20170413-2000I20170412-2000I20170411-2000I20170411-0500I20170410-2000I20170409-2000I20170408-2000I20170407-2000I20170406-2000I20170405-2000Andrey Loskutov1-1/+1 2017-03-15Bug 513304 - Setup API tools on Generic editor bundlesY20170330-1000Y20170321-2315Y20170321-0120Y20170316-0500