Search in sources :

Example 1 with ProjectViewDirectoryHelper

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

the class FavoritesTreeViewPanel method setupToolWindow.

public void setupToolWindow(ToolWindowEx window) {
    final CollapseAllAction collapseAction = new CollapseAllAction(myTree);
    collapseAction.getTemplatePresentation().setIcon(AllIcons.General.CollapseAll);
    collapseAction.getTemplatePresentation().setHoveredIcon(AllIcons.General.CollapseAllHover);
    window.setTitleActions(collapseAction);
    final DefaultActionGroup group = new DefaultActionGroup();
    final ProjectViewDirectoryHelper helper = ProjectViewDirectoryHelper.getInstance(myProject);
    if (helper.supportsFlattenPackages()) {
        group.add(new FavoritesFlattenPackagesAction(myProject, myBuilder));
    }
    if (helper.supportsHideEmptyMiddlePackages()) {
        group.add(new FavoritesCompactEmptyMiddlePackagesAction(myProject, myBuilder));
    }
    if (helper.supportsFlattenPackages()) {
        group.addAction(new FavoritesAbbreviatePackageNamesAction(myProject, myBuilder));
    }
    if (!PlatformUtils.isCidr()) {
        group.add(new FavoritesShowMembersAction(myProject, myBuilder));
    }
    final FavoritesAutoscrollFromSourceHandler handler = new FavoritesAutoscrollFromSourceHandler(myProject, myBuilder);
    handler.install();
    group.add(handler.createToggleAction());
    group.add(new FavoritesAutoScrollToSourceAction(myProject, myAutoScrollToSourceHandler, myBuilder));
    window.setAdditionalGearActions(group);
}
Also used : CollapseAllAction(com.intellij.ui.treeStructure.actions.CollapseAllAction) ProjectViewDirectoryHelper(com.intellij.ide.projectView.impl.nodes.ProjectViewDirectoryHelper)

Example 2 with ProjectViewDirectoryHelper

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

the class AndroidSourceTypeNode method getChildren.

@NotNull
@Override
public Collection<? extends AbstractTreeNode> getChildren() {
    List<AbstractTreeNode> children = Lists.newArrayList();
    ProjectViewDirectoryHelper projectViewDirectoryHelper = ProjectViewDirectoryHelper.getInstance(myProject);
    AndroidProjectTreeBuilder treeBuilder = (AndroidProjectTreeBuilder) myProjectViewPane.getTreeBuilder();
    for (PsiDirectory directory : getSourceDirectories()) {
        Collection<AbstractTreeNode> directoryChildren = projectViewDirectoryHelper.getDirectoryChildren(directory, getSettings(), true);
        children.addAll(annotateWithSourceProvider(directoryChildren));
        // Inform the tree builder of the node that this particular virtual file maps to
        treeBuilder.createMapping(directory.getVirtualFile(), this);
    }
    return children;
}
Also used : PsiDirectory(com.intellij.psi.PsiDirectory) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) ProjectViewDirectoryHelper(com.intellij.ide.projectView.impl.nodes.ProjectViewDirectoryHelper) AndroidProjectTreeBuilder(com.android.tools.idea.navigator.AndroidProjectTreeBuilder) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with ProjectViewDirectoryHelper

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

the class NonAndroidSourceTypeNode method getChildren.

@NotNull
@Override
public Collection<? extends AbstractTreeNode> getChildren() {
    List<VirtualFile> sourceFolders = getSourceFolders();
    List<AbstractTreeNode> children = Lists.newArrayListWithExpectedSize(sourceFolders.size());
    PsiManager psiManager = PsiManager.getInstance(myProject);
    ProjectViewDirectoryHelper directoryHelper = ProjectViewDirectoryHelper.getInstance(myProject);
    for (VirtualFile file : sourceFolders) {
        PsiDirectory dir = psiManager.findDirectory(file);
        if (dir != null) {
            children.addAll(directoryHelper.getDirectoryChildren(dir, getSettings(), true));
        }
    }
    return children;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiDirectory(com.intellij.psi.PsiDirectory) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) PsiManager(com.intellij.psi.PsiManager) ProjectViewDirectoryHelper(com.intellij.ide.projectView.impl.nodes.ProjectViewDirectoryHelper) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProjectViewDirectoryHelper (com.intellij.ide.projectView.impl.nodes.ProjectViewDirectoryHelper)3 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)2 PsiDirectory (com.intellij.psi.PsiDirectory)2 NotNull (org.jetbrains.annotations.NotNull)2 AndroidProjectTreeBuilder (com.android.tools.idea.navigator.AndroidProjectTreeBuilder)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiManager (com.intellij.psi.PsiManager)1 CollapseAllAction (com.intellij.ui.treeStructure.actions.CollapseAllAction)1