Search in sources :

Example 1 with SyntheticLibrary

use of com.intellij.openapi.roots.SyntheticLibrary in project intellij-community by JetBrains.

the class SyntheticLibraryElementNode method getChildren.

@NotNull
@Override
public Collection<AbstractTreeNode> getChildren() {
    List<AbstractTreeNode> children = new ArrayList<>();
    SyntheticLibrary library = getLibrary();
    Project project = Objects.requireNonNull(getProject());
    PsiManager psiManager = PsiManager.getInstance(project);
    for (VirtualFile file : library.getSourceRoots()) {
        if (!file.isValid())
            continue;
        if (file.isDirectory()) {
            PsiDirectory psiDir = psiManager.findDirectory(file);
            if (psiDir != null) {
                children.add(new PsiDirectoryNode(project, psiDir, getSettings()));
            }
        } else {
            PsiFile psiFile = psiManager.findFile(file);
            if (psiFile != null) {
                children.add(new PsiFileNode(project, psiFile, getSettings()));
            }
        }
    }
    return children;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) PsiDirectory(com.intellij.psi.PsiDirectory) ArrayList(java.util.ArrayList) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) SyntheticLibrary(com.intellij.openapi.roots.SyntheticLibrary) PsiManager(com.intellij.psi.PsiManager) PsiFile(com.intellij.psi.PsiFile) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 Project (com.intellij.openapi.project.Project)1 SyntheticLibrary (com.intellij.openapi.roots.SyntheticLibrary)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiDirectory (com.intellij.psi.PsiDirectory)1 PsiFile (com.intellij.psi.PsiFile)1 PsiManager (com.intellij.psi.PsiManager)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1