--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java Tue Aug 18 16:27:31 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java Wed Aug 19 14:42:39 2009 -0500
@@ -269,7 +269,7 @@
for (int i = 0; i < children.length; ++i) {
if (children[i] instanceof ISourceRoot) {
ISourceRoot root = (ISourceRoot)children[i];
- if (root.isOnSourceEntry(folder)) {
+ if (root.isOnSourceEntry(folder) || isParentOfSourceRoot(root, folder)) {
// Get the container
IPath path = folder.getFullPath();
path = path.removeFirstSegments(root.getPath().segmentCount());
@@ -1276,5 +1276,20 @@
// stop indexing jobs for this project
CCoreInternals.getPDOMManager().preCloseProject(create(project));
}
+
+ /**
+ * For nested source roots, checks whether or not a source root is a parent of a given folder
+ * @param root - The source root to check against
+ * @param folder - Folder to check whether or not the given root is a child
+ * @return true is the IFolder is a parent of the ISourceRoot
+ */
+ public boolean isParentOfSourceRoot(ISourceRoot root, IFolder folder) {
+ if (CCorePlugin.showSourceRootsAtTopOfProject()){
+ // not nested source roots so no need to check
+ return false;
+ }
+
+ return folder.getFullPath().isPrefixOf(root.getPath());
+ }
}