Search in sources :

Example 1 with PsiFileNode

use of com.intellij.ide.projectView.impl.nodes.PsiFileNode in project intellij-community by JetBrains.

the class ResourceBundleNode method getChildren.

@Override
@NotNull
public Collection<AbstractTreeNode> getChildren() {
    List<PropertiesFile> propertiesFiles = ObjectUtils.notNull(getValue()).getPropertiesFiles();
    Collection<AbstractTreeNode> children = new ArrayList<>();
    for (PropertiesFile propertiesFile : propertiesFiles) {
        AbstractTreeNode node = new PsiFileNode(myProject, propertiesFile.getContainingFile(), getSettings());
        children.add(node);
    }
    return children;
}
Also used : PsiFileNode(com.intellij.ide.projectView.impl.nodes.PsiFileNode) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) PropertiesFile(com.intellij.lang.properties.psi.PropertiesFile) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with PsiFileNode

use of com.intellij.ide.projectView.impl.nodes.PsiFileNode in project intellij-community by JetBrains.

the class FormNode method getChildren.

private static Collection<BasePsiNode<? extends PsiElement>> getChildren(final Project project, final Form form, final ViewSettings settings) {
    final Set<BasePsiNode<? extends PsiElement>> children = new LinkedHashSet<>();
    children.add(new ClassTreeNode(project, form.getClassToBind(), settings));
    for (PsiFile formBoundToClass : form.getFormFiles()) {
        children.add(new PsiFileNode(project, formBoundToClass, settings));
    }
    return children;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) PsiFileNode(com.intellij.ide.projectView.impl.nodes.PsiFileNode) PsiFile(com.intellij.psi.PsiFile) BasePsiNode(com.intellij.ide.projectView.impl.nodes.BasePsiNode) PsiElement(com.intellij.psi.PsiElement) ClassTreeNode(com.intellij.ide.projectView.impl.nodes.ClassTreeNode)

Example 3 with PsiFileNode

use of com.intellij.ide.projectView.impl.nodes.PsiFileNode in project intellij-community by JetBrains.

the class TreeFileChooserDialog method filterFiles.

private Object[] filterFiles(final Object[] list) {
    Condition<PsiFile> condition = psiFile -> {
        if (myFilter != null && !myFilter.accept(psiFile)) {
            return false;
        }
        boolean accepted = myFileType == null || psiFile.getFileType() == myFileType;
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile != null && !accepted) {
            accepted = virtualFile.getFileType() == myFileType;
        }
        return accepted;
    };
    final List<Object> result = new ArrayList<>(list.length);
    for (Object o : list) {
        final PsiFile psiFile;
        if (o instanceof PsiFile) {
            psiFile = (PsiFile) o;
        } else if (o instanceof PsiFileNode) {
            psiFile = ((PsiFileNode) o).getValue();
        } else {
            psiFile = null;
        }
        if (psiFile != null && !condition.value(psiFile)) {
            continue;
        } else {
            if (o instanceof ProjectViewNode) {
                final ProjectViewNode projectViewNode = (ProjectViewNode) o;
                if (!projectViewNode.canHaveChildrenMatching(condition)) {
                    continue;
                }
            }
        }
        result.add(o);
    }
    return ArrayUtil.toObjectArray(result);
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) FileTypeIndex(com.intellij.psi.search.FileTypeIndex) BaseProjectTreeBuilder(com.intellij.ide.projectView.BaseProjectTreeBuilder) ProjectTreeBuilder(com.intellij.ide.projectView.impl.ProjectTreeBuilder) VirtualFile(com.intellij.openapi.vfs.VirtualFile) ModalityState(com.intellij.openapi.application.ModalityState) THashSet(gnu.trove.THashSet) ChooseByNamePopupComponent(com.intellij.ide.util.gotoByName.ChooseByNamePopupComponent) ChooseByNamePanel(com.intellij.ide.util.gotoByName.ChooseByNamePanel) PsiManager(com.intellij.psi.PsiManager) TreeSpeedSearch(com.intellij.ui.TreeSpeedSearch) ProjectAbstractTreeStructureBase(com.intellij.ide.projectView.impl.ProjectAbstractTreeStructureBase) JBUI(com.intellij.util.ui.JBUI) Disposer(com.intellij.openapi.util.Disposer) ChangeListener(javax.swing.event.ChangeListener) PsiFileNode(com.intellij.ide.projectView.impl.nodes.PsiFileNode) AbstractProjectTreeStructure(com.intellij.ide.projectView.impl.AbstractProjectTreeStructure) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ChangeEvent(javax.swing.event.ChangeEvent) TreePath(javax.swing.tree.TreePath) GotoFileCellRenderer(com.intellij.ide.util.gotoByName.GotoFileCellRenderer) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) KeyEvent(java.awt.event.KeyEvent) DoubleClickListener(com.intellij.ui.DoubleClickListener) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) IdeBundle(com.intellij.ide.IdeBundle) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Function(com.intellij.util.Function) ApplicationManager(com.intellij.openapi.application.ApplicationManager) WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx) NotNull(org.jetbrains.annotations.NotNull) TabbedPaneWrapper(com.intellij.ui.TabbedPaneWrapper) TreeStructureProvider(com.intellij.ide.projectView.TreeStructureProvider) java.util(java.util) ArrayUtil(com.intellij.util.ArrayUtil) FilenameIndex(com.intellij.psi.search.FilenameIndex) ContainerUtil(com.intellij.util.containers.ContainerUtil) KeyAdapter(java.awt.event.KeyAdapter) NodeRenderer(com.intellij.ide.util.treeView.NodeRenderer) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) ChooseByNameModel(com.intellij.ide.util.gotoByName.ChooseByNameModel) TreeSelectionListener(javax.swing.event.TreeSelectionListener) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) PsiElement(com.intellij.psi.PsiElement) AlphaComparator(com.intellij.ide.util.treeView.AlphaComparator) Project(com.intellij.openapi.project.Project) PsiFile(com.intellij.psi.PsiFile) Tree(com.intellij.ui.treeStructure.Tree) DumbAware(com.intellij.openapi.project.DumbAware) ProjectViewNode(com.intellij.ide.projectView.ProjectViewNode) FileType(com.intellij.openapi.fileTypes.FileType) TreeSelectionModel(javax.swing.tree.TreeSelectionModel) MouseEvent(java.awt.event.MouseEvent) java.awt(java.awt) Condition(com.intellij.openapi.util.Condition) ScrollPaneFactory(com.intellij.ui.ScrollPaneFactory) javax.swing(javax.swing) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFileNode(com.intellij.ide.projectView.impl.nodes.PsiFileNode) ProjectViewNode(com.intellij.ide.projectView.ProjectViewNode) PsiFile(com.intellij.psi.PsiFile)

Example 4 with PsiFileNode

use of com.intellij.ide.projectView.impl.nodes.PsiFileNode in project intellij-plugins by JetBrains.

the class DartNodeDecorator method decorate.

@Override
public void decorate(@NotNull final ProjectViewNode node, @NotNull final PresentationData presentation) {
    if (node instanceof PsiFileNode || node instanceof PsiDirectoryNode) {
        final VirtualFile nodeFile = node.getVirtualFile();
        final Project project = node.getProject();
        if (nodeFile != null && project != null && DartAnalysisServerService.getInstance(project).isFileWithErrors(nodeFile)) {
            presentation.setAttributesKey(CodeInsightColors.ERRORS_ATTRIBUTES);
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) PsiFileNode(com.intellij.ide.projectView.impl.nodes.PsiFileNode) PsiDirectoryNode(com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode)

Example 5 with PsiFileNode

use of com.intellij.ide.projectView.impl.nodes.PsiFileNode in project android by JetBrains.

the class AndroidSourceTypeNode method annotateWithSourceProvider.

private Collection<AbstractTreeNode> annotateWithSourceProvider(Collection<AbstractTreeNode> directoryChildren) {
    List<AbstractTreeNode> children = Lists.newArrayListWithExpectedSize(directoryChildren.size());
    for (AbstractTreeNode child : directoryChildren) {
        if (child instanceof PsiDirectoryNode) {
            PsiDirectory directory = ((PsiDirectoryNode) child).getValue();
            children.add(new AndroidPsiDirectoryNode(myProject, directory, getSettings(), findSourceProvider(directory.getVirtualFile())));
        } else if (child instanceof PsiFileNode) {
            PsiFile file = ((PsiFileNode) child).getValue();
            children.add(new AndroidPsiFileNode(myProject, file, getSettings(), findSourceProvider(file.getVirtualFile())));
        } else {
            children.add(child);
        }
    }
    return children;
}
Also used : PsiFileNode(com.intellij.ide.projectView.impl.nodes.PsiFileNode) PsiDirectory(com.intellij.psi.PsiDirectory) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) PsiDirectoryNode(com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode) PsiFile(com.intellij.psi.PsiFile)

Aggregations

PsiFileNode (com.intellij.ide.projectView.impl.nodes.PsiFileNode)12 PsiFile (com.intellij.psi.PsiFile)8 NotNull (org.jetbrains.annotations.NotNull)7 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)6 Project (com.intellij.openapi.project.Project)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 PsiDirectoryNode (com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode)3 PropertiesFile (com.intellij.lang.properties.psi.PropertiesFile)2 PsiElement (com.intellij.psi.PsiElement)2 ArrayList (java.util.ArrayList)2 IdeBundle (com.intellij.ide.IdeBundle)1 BaseProjectTreeBuilder (com.intellij.ide.projectView.BaseProjectTreeBuilder)1 ProjectViewNode (com.intellij.ide.projectView.ProjectViewNode)1 TreeStructureProvider (com.intellij.ide.projectView.TreeStructureProvider)1 ViewSettings (com.intellij.ide.projectView.ViewSettings)1 AbstractProjectTreeStructure (com.intellij.ide.projectView.impl.AbstractProjectTreeStructure)1 ProjectAbstractTreeStructureBase (com.intellij.ide.projectView.impl.ProjectAbstractTreeStructureBase)1 ProjectTreeBuilder (com.intellij.ide.projectView.impl.ProjectTreeBuilder)1 BasePsiNode (com.intellij.ide.projectView.impl.nodes.BasePsiNode)1 ClassTreeNode (com.intellij.ide.projectView.impl.nodes.ClassTreeNode)1