Eclipse:如何重新启动 LaunchConfiguration
我正在为 Eclipse 开发一个小插件,以便以编程方式(重新)启动 LaunchConfigurations。
我可以启动配置,但我想增强以下代码,以便在启动之前首先关闭具有给定名称的所有正在运行的配置。
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;
}
}
如何获取所有正在运行的配置?
如何停止正在运行的配置?
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 with 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法对此进行测试,但您也许可以获得所有正在运行的 ILaunchConfigurations 使用的列表。
ILaunch 提供了您可以使用的方法,例如 .getProcesses()。从那里您可以终止与启动相关的进程。
I cannot test this but you may be able to get a list of all running ILaunchConfigurations using.
ILaunch then has methods you can use such as .getProcesses(). From there you can kill the process associated with the launch.