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