1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 351422 - CModelUtil.getSourceFolder returns non-source folders.

This commit is contained in:
Mohamed Hussein 2011-08-15 12:18:42 -04:00 committed by Mikhail Khodjaiants
parent eeef5ce247
commit e0b1937020

View file

@ -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;
}