diff --git a/java/java-impl/src/com/intellij/ide/todo/nodes/TodoJavaTreeHelper.java b/java/java-impl/src/com/intellij/ide/todo/nodes/TodoJavaTreeHelper.java index 89d062002df2..46e525288bd1 100644 --- a/java/java-impl/src/com/intellij/ide/todo/nodes/TodoJavaTreeHelper.java +++ b/java/java-impl/src/com/intellij/ide/todo/nodes/TodoJavaTreeHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -133,7 +133,9 @@ public class TodoJavaTreeHelper extends TodoTreeHelper { } } } - super.addPackagesToChildren(children, module, builder); + final List roots = collectContentRoots(module); + roots.removeAll(sourceRoots); + addDirsToChildren(roots, children, builder); } @Nullable diff --git a/platform/lang-impl/src/com/intellij/ide/todo/nodes/TodoTreeHelper.java b/platform/lang-impl/src/com/intellij/ide/todo/nodes/TodoTreeHelper.java index 731761a89cd4..0bad82fa47b8 100644 --- a/platform/lang-impl/src/com/intellij/ide/todo/nodes/TodoTreeHelper.java +++ b/platform/lang-impl/src/com/intellij/ide/todo/nodes/TodoTreeHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,21 +51,25 @@ public class TodoTreeHelper { } public void addPackagesToChildren(ArrayList children, - Module module, - TodoTreeBuilder builder) { - final PsiManager psiManager = PsiManager.getInstance(myProject); + Module module, + TodoTreeBuilder builder) { + addDirsToChildren(collectContentRoots(module), children, builder); + } + + protected List collectContentRoots(Module module) { final List roots = new ArrayList<>(); - final List sourceRoots = new ArrayList<>(); if (module == null) { - final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(myProject); - ContainerUtil.addAll(roots, projectRootManager.getContentRoots()); - ContainerUtil.addAll(sourceRoots, projectRootManager.getContentSourceRoots()); + ContainerUtil.addAll(roots, ProjectRootManager.getInstance(myProject).getContentRoots()); } else { - ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); - ContainerUtil.addAll(roots, moduleRootManager.getContentRoots()); - ContainerUtil.addAll(sourceRoots, moduleRootManager.getSourceRoots()); + ContainerUtil.addAll(roots, ModuleRootManager.getInstance(module).getContentRoots()); } - roots.removeAll(sourceRoots); + return roots; + } + + protected void addDirsToChildren(List roots, + ArrayList children, + TodoTreeBuilder builder) { + final PsiManager psiManager = PsiManager.getInstance(myProject); for (VirtualFile dir : roots) { final PsiDirectory directory = psiManager.findDirectory(dir); if (directory == null) { @@ -80,7 +84,7 @@ public class TodoTreeHelper { } } - public Collection getDirectoryChildren(PsiDirectory psiDirectory, TodoTreeBuilder builder, boolean isFlatten) { + public Collection getDirectoryChildren(PsiDirectory psiDirectory, TodoTreeBuilder builder, boolean isFlatten) { ArrayList children = new ArrayList<>(); if (!isFlatten || !skipDirectory(psiDirectory)) { final Iterator iterator = builder.getFiles(psiDirectory);