--- ./results/plugins/org.eclipse.cdt.core/schema/DynamicScannerInfoProvider.exsd.fix 2006-07-12 16:58:30.000000000 -0400 +++ ./results/plugins/org.eclipse.cdt.core/schema/DynamicScannerInfoProvider.exsd 2006-07-12 16:56:05.000000000 -0400 @@ -0,0 +1,105 @@ + + + + + + + + + ScannerInfoProvider that extracts from dynamic build info taken from makefiles. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Class which implements IScannerInfoProvider dynamically from makefile build. + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + + + + + + + + + --- ./results/plugins/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java.fix 2006-07-12 16:54:55.000000000 -0400 +++ ./results/plugins/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java 2006-07-12 16:56:05.000000000 -0400 @@ -856,6 +856,28 @@ public class CCorePlugin extends Plugin } return provider; } + + /** + * Get the dynamic IScannerInfoProvider contributed interface for the platform. + * @return IScannerInfoProvider or null + */ + public IScannerInfoProvider getDynamicScannerInfoProvider() throws CoreException { + IScannerInfoProvider provider = null; + IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "DynamicScannerInfoProvider"); //$NON-NLS-1$ + if (extension != null) { + IExtension[] extensions = extension.getExtensions(); + try { + if (extensions.length > 0) { + IConfigurationElement[] configElements = extensions[0].getConfigurationElements(); + provider = (IScannerInfoProvider) configElements[0].createExecutableExtension("class"); + } + return provider; + } catch (CoreException e) { + // log(e); + } + } + return null; + } /** * Helper function, returning the contenttype for a filename --- ./results/plugins/org.eclipse.cdt.core/plugin.xml.fix 2006-07-12 16:54:19.000000000 -0400 +++ ./results/plugins/org.eclipse.cdt.core/plugin.xml 2006-07-12 16:56:05.000000000 -0400 @@ -44,6 +44,7 @@ + --- ./results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java.fix 2006-07-12 16:55:40.000000000 -0400 +++ ./results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java 2006-07-12 16:56:05.000000000 -0400 @@ -37,8 +37,10 @@ import org.eclipse.core.resources.IResou import org.eclipse.core.resources.IResourceProxyVisitor; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.QualifiedName; import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelection; @@ -79,30 +81,47 @@ public class OpenIncludeAction extends A if (include == null) { return; } - try { + boolean dynamicIncludePathFound = false; IResource res = include.getUnderlyingResource(); ArrayList filesFound = new ArrayList(4); + IResource resToScan = res; + QualifiedName dynamicScannerPrevFile = new QualifiedName("org.eclipse.cdt.core", "DynamicScannerPrevFile"); if (res != null) { IProject proj = res.getProject(); String includeName = include.getElementName(); - // Search in the scannerInfo information - IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(proj); + IScannerInfoProvider provider = CCorePlugin.getDefault().getDynamicScannerInfoProvider(); if (provider != null) { - IScannerInfo info = provider.getScannerInformation(res); - // XXXX this should fall back to project by itself - if (info == null) { - info = provider.getScannerInformation(proj); - } + while (resToScan.getSessionProperty(dynamicScannerPrevFile) != null) + resToScan = (IResource)resToScan.getSessionProperty(dynamicScannerPrevFile); + IScannerInfo info = provider.getScannerInformation(resToScan); if (info != null) { String[] includePaths = info.getIncludePaths(); HashSet found = new HashSet(); findFile(includePaths, includeName, filesFound, found); } - if (filesFound.size() == 0) { - // Fall back and search the project - findFile(proj, new Path(includeName), filesFound); + } + if (filesFound.size() == 0) { + // Search in the scannerInfo information + provider = CCorePlugin.getDefault().getScannerInfoProvider(proj); + if (provider != null) { + IScannerInfo info = provider.getScannerInformation(res); + // XXXX this should fall back to project by itself + if (info == null) { + info = provider.getScannerInformation(proj); + } + if (info != null) { + String[] includePaths = info.getIncludePaths(); + HashSet found = new HashSet(); + findFile(includePaths, includeName, filesFound, found); + } + if (filesFound.size() == 0) { + // Fall back and search the project + findFile(proj, new Path(includeName), filesFound); + } } + } else { + dynamicIncludePathFound = true; } } IPath fileToOpen; @@ -110,7 +129,7 @@ public class OpenIncludeAction extends A if (nElementsFound == 0) { noElementsFound(); fileToOpen= null; - } else if (nElementsFound == 1) { + } else if (nElementsFound == 1 || dynamicIncludePathFound) { fileToOpen= (IPath) filesFound.get(0); } else { fileToOpen= chooseFile(filesFound); @@ -119,6 +138,8 @@ public class OpenIncludeAction extends A if (fileToOpen != null) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(fileToOpen); if (file != null) { + if (dynamicIncludePathFound) + file.setSessionProperty(dynamicScannerPrevFile, resToScan); EditorUtility.openInEditor(file); } else { ICProject cproject = include.getCProject();