/** * Initialize a <code>ILaunchConfigurationWorkingCopy</code> either by using an existing one (if * found), or using a default configuration (for example, the one used for the most recent * launch), or by creating a new one based on the <code>project</code> name and the <code>confName * </code>. * * @throws CoreException if getting an working copy from an existing configuration fails */ private static ILaunchConfigurationWorkingCopy createLaunchConfiguration( IProject project, String confName, RunInfo runInfo) { ILaunchManager launchManager = getLaunchManager(); ILaunchConfiguration config = ConfigurationHelper.findConfiguration(launchManager, project, confName, runInfo); ILaunchConfigurationWorkingCopy configWC = null; if (null != config) { try { configWC = config.getWorkingCopy(); } catch (CoreException cex) { TestNGPlugin.log( new Status( IStatus.ERROR, TestNGPlugin.PLUGIN_ID, TestNGPluginConstants.LAUNCH_ERROR, "Cannot create working copy of existing launcher " + config.getName(), cex)); } } if (null == configWC) { if (confName == null && runInfo != null) { confName = runInfo.getClassName() + "." + runInfo.getMethodName(); } configWC = ConfigurationHelper.createBasicConfiguration(launchManager, project, confName); } return configWC; }