Source:
<code>private void profileLocalApplication(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException { monitor.beginTask(LaunchMessages.LocalCDILaunchDelegate_11, 10); if (monitor.isCanceled()) { return; } monitor.worked(1); ICDTProfileDelegate delegate = null; IExtensionPoint extPoint = Platform.getExtensionRegistry() .getExtensionPoint(LaunchUIPlugin.PLUGIN_ID, "profilingProvider"); IConfigurationElement[] configs = extPoint.getConfigurationElements(); for (IConfigurationElement configElement : configs) { if (configElement.getName().equals("provider")) { try { Object obj = configElement .createExecutableExtension("delegate"); if (obj instanceof ICDTProfileDelegate) { <START> delegate = (ICDTProfileDelegate)obj; <END> break; } } catch (CoreException e) { } } } try { if (delegate != null) { if (config.getAttribute("org.eclipse.cdt.launch.profilingProvider", "").equals("")) { ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); delegate.setDefaultProfileLaunchAttributes(wc); config = wc.doSave(); } delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, monitor); } else { IPath exePath = CDebugUtils.verifyProgramPath(config); File wd = getWorkingDirectory(config); if (wd == null) { wd = new File(System.getProperty("user.home", ".")); } String arguments[] = getProgramArgumentsArray(config); ArrayList command = new ArrayList(1 + arguments.length); command.add(exePath.toOSString()); command.addAll(Arrays.asList(arguments)); String[] commandArray = (String[])command.toArray(new String[command.size()]); boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT); monitor.worked(2); Process process = exec(commandArray, getEnvironment(config), wd, usePty); monitor.worked(6); DebugPlugin.newProcess(launch, process, renderProcessLabel(commandArray[0])); } } finally { monitor.done(); } }</code><technical_language>extensionPoint delegate. handle multiple extension this extensionPoint</technical_language>

Target:
private void profileLocalApplication(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException { monitor.beginTask(LaunchMessages.LocalCDILaunchDelegate_11, 10); if (monitor.isCanceled()) { return; } monitor.worked(1); ICDTProfileDelegate delegate = null; IExtensionPoint extPoint = Platform.getExtensionRegistry() .getExtensionPoint(LaunchUIPlugin.PLUGIN_ID, "profilingProvider"); IConfigurationElement[] configs = extPoint.getConfigurationElements(); for (IConfigurationElement configElement : configs) { if (configElement.getName().equals("provider")) { try { Object obj = configElement .createExecutableExtension("delegate"); if (obj instanceof ICDTProfileDelegate) { delegate = (ICDTProfileDelegate)obj; break; } } catch (CoreException e) { } } } try { if (delegate != null) { if (config.getAttribute("org.eclipse.cdt.launch.profilingProvider", "").equals("")) { ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); delegate.setDefaultProfileLaunchAttributes(wc); config = wc.doSave(); } delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, monitor); } else { MessageDialog.openInformation(LaunchUIPlugin.getShell(), LaunchMessages.LocalCDILaunchDelegate_NoProfilingProvider_Title, LaunchMessages.LocalCDILaunchDelegate_NoProfilingProvider_Message); } } finally { monitor.done(); } }