开发者

Eclipse: How to restart a LaunchConfiguration

开发者 https://www.devze.com 2023-02-11 01:48 出处:网络
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 C

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号