# HG changeset patch # User timkelly # Date 1250710959 18000 # Node ID 82f77257427393f38f3d5a8f06b7496cf8a92a78 # Parent 451134ee4e6e2b72fb85c9f52bc3d81b1d056ef8 fix 9513, indexer refresh problems with nested source paths diff -r 451134ee4e6e -r 82f772574273 cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java --- 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()); + } }