summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Hussein2011-08-15 12:18:42 (EDT)
committerMikhail Khodjaiants2011-08-15 12:18:42 (EDT)
commite0b1937020793057ce96ee45591a9c35d1fe8704 (patch)
treedfc05d5b3d642a915ab1efead1191bb35b9dc5f0
parenteeef5ce247d1c2148cfa1895e3d1d4f40459d0da (diff)
downloadorg.eclipse.cdt-e0b1937020793057ce96ee45591a9c35d1fe8704.zip
org.eclipse.cdt-e0b1937020793057ce96ee45591a9c35d1fe8704.tar.gz
org.eclipse.cdt-e0b1937020793057ce96ee45591a9c35d1fe8704.tar.bz2
Bug 351422 - CModelUtil.getSourceFolder returns non-source folders.
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/CModelUtil.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/CModelUtil.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/CModelUtil.java
index cf72713..f0fea27 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/CModelUtil.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/util/CModelUtil.java
@@ -71,21 +71,17 @@ public class CModelUtil {
*/
public static ICContainer getSourceFolder(ICElement element) {
ICContainer folder = null;
- if (element != null) {
- boolean foundSourceRoot = false;
+ if (element != null) {
ICElement curr = element;
- while (curr != null && !foundSourceRoot) {
- if (curr instanceof ICContainer && folder == null) {
- folder = (ICContainer)curr;
- }
- foundSourceRoot = (curr instanceof ISourceRoot);
+ while (curr != null && !(curr instanceof ISourceRoot)) {
curr = curr.getParent();
}
+ folder = (ISourceRoot)curr;
if (folder == null) {
ICProject cproject = element.getCProject();
folder = cproject.findSourceRoot(cproject.getProject());
}
- }
+ }
return folder;
}