Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Run Configuration that spawns a new shell process (Eclipse Plugin Development )
Run Configuration that spawns a new shell process [message #1840669] Wed, 21 April 2021 19:02
Eclipse  Man is currently offline Eclipse ManFriend
Messages: 1
Registered: April 2021
Junior Member

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 and came up with this

public class ACTLaunchConfigurationDelegate implements ILaunchConfigurationDelegate {
	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
		//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

		        name="ACT Launch"
		        modes="run, debug"
Previous Topic:Eclipse Photon not working after updating MacOS to 10.14
Next Topic:Go to Interface Implementation - faster than CTRL-T ?
Goto Forum:

Current Time: Sat May 28 08:53:47 GMT 2022

Powered by FUDForum. Page generated in 0.02118 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top