projectview tests fixed

This commit is contained in:
Kirill Kalishev
2011-04-08 21:44:48 +04:00
parent 3d411aa9dc
commit d0fc0789d8
4 changed files with 9 additions and 4 deletions
@@ -41,7 +41,10 @@ public class PackageViewLibrariesNode extends ProjectViewNode<LibrariesElement>{
}
public boolean contains(@NotNull final VirtualFile file) {
return someChildContainsFile(file);
ProjectFileIndex index = ProjectRootManager.getInstance(getProject()).getFileIndex();
if (!index.isInLibrarySource(file) && !index.isInLibraryClasses(file)) return false;
return someChildContainsFile(file, false);
}
@NotNull
@@ -130,11 +130,10 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im
public boolean someChildContainsFile(final VirtualFile file, boolean optimizeByCheckingFileRootsFirst) {
VirtualFile parent = file.getParent();
if (parent == null) return false;
boolean mayContain = false;
if (optimizeByCheckingFileRootsFirst) {
if (optimizeByCheckingFileRootsFirst && parent != null) {
Collection<VirtualFile> roots = getRoots();
for (VirtualFile eachRoot : roots) {
if (parent.equals(eachRoot.getParent())) {
@@ -83,7 +83,7 @@ public abstract class ModuleGroupNode extends ProjectViewNode<ModuleGroup> imple
}
public boolean contains(@NotNull VirtualFile file) {
return someChildContainsFile(file);
return someChildContainsFile(file, false);
}
public void update(PresentationData presentation) {
@@ -78,6 +78,9 @@ public class ProjectViewTestUtil {
boolean actual = eachNode.contains(eachFile);
boolean expected = map.get(eachFile).contains(eachNode);
if (actual != expected) {
boolean actual1 = eachNode.contains(eachFile);
boolean expected1 = map.get(eachFile).contains(eachNode);
Assert.assertTrue("file=" + eachFile + " node=" + eachNode.getTestPresentation() + " expected:" + expected, false);
}
}