public static ILaunchConfiguration findLaunch(String moduleName, String projectName) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(Constants.LAUNCH_CONFIG_TYPE);
ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(configType);
ILaunchConfiguration toLaunch = null;
for (int i = 0; i < launchConfigurations.length; i++) {
ILaunchConfiguration configuration = launchConfigurations[i];
if (moduleName.equals(configuration.getAttribute(Constants.LAUNCH_ATTR_MODULE_NAME, "")) //$NON-NLS-1$
&& projectName.equals(configuration.getAttribute(Constants.LAUNCH_ATTR_PROJECT_NAME, ""))) {//$NON-NLS-1$
toLaunch = configuration;
break;
}
}
return toLaunch;