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:
parent
eeef5ce247
commit
e0b1937020
1 changed files with 4 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue