Run Configuration that spawns a new shell process [message #1840669] |
Wed, 21 April 2021 19:02 |
Eclipse Man Messages: 1 Registered: April 2021 |
Junior Member |
|
|
Hi,
I am a new eclipse user, and I am trying to make an editor plugin. I would like to programmatically create a run configuration that runs some command line tools upon invocation in a new shell process.
Currently, I am using the "External Tools Configuration" menu that shows up when I run my plugin as an Eclipse Application. I am able to specify the working directory here and get eclipse to spawn a new shell process in the console. However, this is not the solution I need because
1) In the console, I am not able to see any shell prompts, and the output is jumbled up sometimes.
2) It is not done programmatically, so I don't think I will be able to use the configuration if I export the plugin as a jar file.
I followed the thread here https://www.eclipse.org/forums/index.php?t=msg&th=1100453&goto=1814424&#msg_1814424 and came up with this
public class ACTLaunchConfigurationDelegate implements ILaunchConfigurationDelegate {
@Override
public void launch(ILaunchConfiguration config,
String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException {
// Make a new launch configuration
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType("acteditor.editors.launchConfig");
ILaunchConfigurationWorkingCopy configuration = type.newInstance(null, "ACT Launch");
// Get the path to aflat (the command line tool)
String aflat_path = System.getenv("ACT_HOME") + "/bin/aflat";
try {
Runtime.getRuntime().exec("sh -c" + aflat_path);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//configuration.getAttribute(aflat_path, false);
configuration.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
}
But this does not work. That is, when i run the plugin, it does not show up anywhere as a run configuration file. Can someone please point me in the right direction? I have also specified it in my plugin.xml
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
name="ACT Launch"
delegate="acteditor.editors.ACTLaunchConfigurationDelegate"
modes="run, debug"
id="acteditor.editors.launchConfig">
</launchConfigurationType>
</extension>
|
|
|
Powered by
FUDForum. Page generated in 0.02838 seconds