Eclipse: How can I execute a launch configuration programmatically?

后端 未结 1 646
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-10 18:28

I have various launch configuration files in my Eclipse project. Is there any way how I can execute an arbitrary launch configuration programmatically?

相关标签:
1条回答
  • 2020-12-10 19:28
           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);
                        }
                    }
                }
    
    0 讨论(0)
提交回复
热议问题