Eclipse: How to restart a LaunchConfiguration
I am working on a little Plugin for Eclipse to (re)start LaunchConfigurations programmatically.
I can launch a Configuration, but I want to enhance the following Code to first shut down all running Configurations w开发者_StackOverflow社区ith the given Name before launching.
public void restartLaunchConfiguration(String configurationName) throws Exception {
final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
for(final ILaunchConfiguration cfg : manager.getLaunchConfigurations()){
final String cfgName = cfg.getName();
if(!configurationName.equals(cfgName)) continue;
cfg.launch("debug", null);
break;
}
}
How do I get all running Configurations?
How to stop a running Configuration?
I cannot test this but you may be able to get a list of all running ILaunchConfigurations using.
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunch[] runningLaunches = manager.getLaunches();
ILaunch then has methods you can use such as .getProcesses(). From there you can kill the process associated with the launch.
精彩评论