mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
projectivew: selectin fix for libs
This commit is contained in:
@@ -125,21 +125,30 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im
|
||||
}
|
||||
|
||||
public boolean someChildContainsFile(final VirtualFile file) {
|
||||
return someChildContainsFile(file, true);
|
||||
}
|
||||
|
||||
public boolean someChildContainsFile(final VirtualFile file, boolean optimizeByCheckingFileRootsFirst) {
|
||||
VirtualFile parent = file.getParent();
|
||||
if (parent == null) return false;
|
||||
|
||||
boolean mayContain = false;
|
||||
Collection<VirtualFile> roots = getRoots();
|
||||
for (VirtualFile eachRoot : roots) {
|
||||
if (parent.equals(eachRoot.getParent())) {
|
||||
mayContain = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (VfsUtil.isAncestor(eachRoot, file, true)) {
|
||||
mayContain = true;
|
||||
break;
|
||||
if (optimizeByCheckingFileRootsFirst) {
|
||||
Collection<VirtualFile> roots = getRoots();
|
||||
for (VirtualFile eachRoot : roots) {
|
||||
if (parent.equals(eachRoot.getParent())) {
|
||||
mayContain = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (VfsUtil.isAncestor(eachRoot, file, true)) {
|
||||
mayContain = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mayContain = true;
|
||||
}
|
||||
|
||||
if (!mayContain) {
|
||||
|
||||
+4
-1
@@ -47,7 +47,10 @@ public class ExternalLibrariesNode extends ProjectViewNode<String> {
|
||||
|
||||
@Override
|
||||
public boolean contains(@NotNull 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
|
||||
|
||||
Reference in New Issue
Block a user