【问题标题】:Eclipse: How can I execute a launch configuration programmatically?Eclipse:如何以编程方式执行启动配置?
【发布时间】:2012-04-23 15:47:02
【问题描述】:

我的 Eclipse 项目中有各种启动配置文件。有什么方法可以以编程方式执行任意启动配置?

【问题讨论】:

    标签: java eclipse eclipse-plugin


    【解决方案1】:
           ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    
           ILaunchConfigurationType type =     manager.getLaunchConfigurationType("org.eclipse.cdt.launch.applicationLaunchType");
           ILaunchConfiguration[] lcs = manager.getLaunchConfigurations(type);
    
                for (ILaunchConfiguration iLaunchConfiguration : lcs) {
                    if (iLaunchConfiguration.getName().equals("Test PThread")) {
                        ILaunchConfigurationWorkingCopy t = iLaunchConfiguration.getWorkingCopy();
                        ILaunchConfiguration config = t.doSave();
                        if (config != null) {
                            // config.launch(ILaunchManager.RUN_MODE, null);
                            DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
                        }
                    }
                }
    

    【讨论】:

      猜你喜欢
      • 2017-11-25
      • 2011-03-15
      • 2019-11-16
      • 2021-12-04
      • 2015-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多