cdt/cdt_6_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
changeset 73 82f772574273
parent 37 c2bce6dd59e7
child 75 689d22da9f18
equal deleted inserted replaced
72:451134ee4e6e 73:82f772574273
   267 		try {
   267 		try {
   268 			ICElement[] children = cproject.getChildren();
   268 			ICElement[] children = cproject.getChildren();
   269 			for (int i = 0; i < children.length; ++i) {
   269 			for (int i = 0; i < children.length; ++i) {
   270 				if (children[i] instanceof ISourceRoot) {
   270 				if (children[i] instanceof ISourceRoot) {
   271 					ISourceRoot root = (ISourceRoot)children[i];
   271 					ISourceRoot root = (ISourceRoot)children[i];
   272 					if (root.isOnSourceEntry(folder)) {
   272 					if (root.isOnSourceEntry(folder) || isParentOfSourceRoot(root, folder)) {
   273 						// Get the container
   273 						// Get the container
   274 						IPath path = folder.getFullPath();
   274 						IPath path = folder.getFullPath();
   275 						path = path.removeFirstSegments(root.getPath().segmentCount());
   275 						path = path.removeFirstSegments(root.getPath().segmentCount());
   276 						String[] segments = path.segments();
   276 						String[] segments = path.segments();
   277 						ICContainer cfolder = root;
   277 						ICContainer cfolder = root;
  1274 		// stop the binary runner for this project
  1274 		// stop the binary runner for this project
  1275 		removeBinaryRunner(project);
  1275 		removeBinaryRunner(project);
  1276 		// stop indexing jobs for this project
  1276 		// stop indexing jobs for this project
  1277 		CCoreInternals.getPDOMManager().preCloseProject(create(project));
  1277 		CCoreInternals.getPDOMManager().preCloseProject(create(project));
  1278 	}
  1278 	}
       
  1279 	
       
  1280 	/**
       
  1281 	 * For nested source roots, checks whether or not a source root is a parent of a given folder
       
  1282 	 * @param root - The source root to check against
       
  1283 	 * @param folder - Folder to check whether or not the given root is a child
       
  1284 	 * @return true is the IFolder is a parent of the ISourceRoot
       
  1285 	 */
       
  1286 	public boolean isParentOfSourceRoot(ISourceRoot root, IFolder folder) {
       
  1287 		if (CCorePlugin.showSourceRootsAtTopOfProject()){
       
  1288 			// not nested source roots so no need to check
       
  1289 			return false;
       
  1290 		}
       
  1291 		
       
  1292 		return folder.getFullPath().isPrefixOf(root.getPath());
       
  1293 	}
  1279 
  1294 
  1280 }
  1295 }