Blob Blame History Raw
--- ./results/plugins/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScannerInfoPlus.java.fix	2006-08-29 14:28:17.000000000 -0400
+++ ./results/plugins/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IScannerInfoPlus.java	2006-08-29 14:28:54.000000000 -0400
@@ -0,0 +1,16 @@
+package org.eclipse.cdt.core.parser;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+
+public interface IScannerInfoPlus extends IScannerInfo {
+
+	/**
+	 * Map an open include file as being included by a specific resource.
+	 * 
+	 * @param include the include file
+	 * @param res the resource that included the include file
+	 */
+	public void createIncludeChain(IFile include, IResource res);
+
+}
--- ./results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java.fix	2006-08-29 14:32:46.000000000 -0400
+++ ./results/plugins/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java	2006-08-29 14:33:19.000000000 -0400
@@ -24,6 +24,7 @@ import org.eclipse.cdt.core.model.ICElem
 import org.eclipse.cdt.core.model.ICProject;
 import org.eclipse.cdt.core.model.ITranslationUnit;
 import org.eclipse.cdt.core.parser.IScannerInfo;
+import org.eclipse.cdt.core.parser.IScannerInfoPlus;
 import org.eclipse.cdt.core.parser.IScannerInfoProvider;
 import org.eclipse.cdt.internal.ui.CPluginImages;
 import org.eclipse.cdt.internal.ui.dialogs.ElementListSelectionDialog;
@@ -37,8 +38,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,17 +82,16 @@ public class OpenIncludeAction extends A
 		if (include == null) {
 			return;
 		}
-		
 		try {
 			IResource res = include.getUnderlyingResource();
+			IScannerInfo info = null;
 			ArrayList filesFound = new ArrayList(4);
 			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().getScannerInfoProvider(proj);
 				if (provider != null) {
-					IScannerInfo info = provider.getScannerInformation(res);
+					info = provider.getScannerInformation(res);
 					// XXXX this should fall back to project by itself
 					if (info == null) {
 						info = provider.getScannerInformation(proj);
@@ -110,7 +112,7 @@ public class OpenIncludeAction extends A
 			if (nElementsFound == 0) {
 				noElementsFound();
 				fileToOpen= null;
-			} else if (nElementsFound == 1) {
+			} else if (nElementsFound == 1 || info instanceof IScannerInfoPlus) {
 				fileToOpen= (IPath) filesFound.get(0);
 			} else {
 				fileToOpen= chooseFile(filesFound);
@@ -119,6 +121,11 @@ public class OpenIncludeAction extends A
 			if (fileToOpen != null) {
 				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(fileToOpen);
 				if (file != null) {
+					// If dealing with an IScannerInfoPlus, we want to register
+					// the resource with the include file it includes.
+					if (info instanceof IScannerInfoPlus) {
+						((IScannerInfoPlus)info).createIncludeChain(file, res);
+					}
 					EditorUtility.openInEditor(file);
 				}  else {
 					ICProject cproject = include.getCProject();