}
private static ILaunchConfiguration createLaunch(String moduleName, String projectName) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(Constants.LAUNCH_CONFIG_TYPE);
ILaunchConfigurationWorkingCopy copy = configType.newInstance(null, launchManager.generateUniqueLaunchConfigurationNameFrom(moduleName));
copy.setAttribute(Constants.LAUNCH_ATTR_MODULE_NAME, moduleName);
copy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
copy.setAttribute(Constants.LAUNCH_ATTR_PROJECT_NAME, projectName);
return copy.doSave();