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

@ -72,15 +72,11 @@ public class CModelUtil {
public static ICContainer getSourceFolder(ICElement element) { public static ICContainer getSourceFolder(ICElement element) {
ICContainer folder = null; ICContainer folder = null;
if (element != null) { if (element != null) {
boolean foundSourceRoot = false;
ICElement curr = element; ICElement curr = element;
while (curr != null && !foundSourceRoot) { while (curr != null && !(curr instanceof ISourceRoot)) {
if (curr instanceof ICContainer && folder == null) {
folder = (ICContainer)curr;
}
foundSourceRoot = (curr instanceof ISourceRoot);
curr = curr.getParent(); curr = curr.getParent();
} }
folder = (ISourceRoot)curr;
if (folder == null) { if (folder == null) {
ICProject cproject = element.getCProject(); ICProject cproject = element.getCProject();
folder = cproject.findSourceRoot(cproject.getProject()); folder = cproject.findSourceRoot(cproject.getProject());