Search in sources :

Example 1 with DefaultTreeExpander

use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.

the class RunDashboardContent method createToolbar.

private JComponent createToolbar() {
    JPanel toolBarPanel = new JPanel(new GridLayout());
    DefaultActionGroup leftGroup = new DefaultActionGroup();
    leftGroup.add(ActionManager.getInstance().getAction(RUN_DASHBOARD_TOOLBAR));
    // TODO [konstantin.aleev] provide context help ID
    //leftGroup.add(new Separator());
    //leftGroup.add(new ContextHelpAction(HELP_ID));
    ActionToolbar leftActionToolBar = ActionManager.getInstance().createActionToolbar(PLACE_TOOLBAR, leftGroup, false);
    toolBarPanel.add(leftActionToolBar.getComponent());
    myTree.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, new DataProvider() {

        @Override
        public Object getData(@NonNls String dataId) {
            if (KEY.getName().equals(dataId)) {
                return RunDashboardContent.this;
            }
            return null;
        }
    });
    leftActionToolBar.setTargetComponent(myTree);
    DefaultActionGroup rightGroup = new DefaultActionGroup();
    TreeExpander treeExpander = new DefaultTreeExpander(myTree);
    AnAction expandAllAction = CommonActionsManager.getInstance().createExpandAllAction(treeExpander, this);
    rightGroup.add(expandAllAction);
    AnAction collapseAllAction = CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);
    rightGroup.add(collapseAllAction);
    rightGroup.add(new Separator());
    myGroupers.stream().filter(grouper -> !grouper.getRule().isAlwaysEnabled()).forEach(grouper -> rightGroup.add(new GroupAction(grouper)));
    ActionToolbar rightActionToolBar = ActionManager.getInstance().createActionToolbar(PLACE_TOOLBAR, rightGroup, false);
    toolBarPanel.add(rightActionToolBar.getComponent());
    rightActionToolBar.setTargetComponent(myTree);
    return toolBarPanel;
}
Also used : com.intellij.ui.content(com.intellij.ui.content) TreeExpansionEvent(javax.swing.event.TreeExpansionEvent) com.intellij.ide.util.treeView(com.intellij.ide.util.treeView) NonNls(org.jetbrains.annotations.NonNls) HashSet(java.util.HashSet) ActionPresentation(com.intellij.ide.util.treeView.smartTree.ActionPresentation) Comparing(com.intellij.openapi.util.Comparing) DashboardGrouper(com.intellij.execution.dashboard.tree.DashboardGrouper) Disposer(com.intellij.openapi.util.Disposer) Project(com.intellij.openapi.project.Project) Tree(com.intellij.ui.treeStructure.Tree) ExecutionBundle(com.intellij.execution.ExecutionBundle) DumbAware(com.intellij.openapi.project.DumbAware) CommonActionsManager(com.intellij.ide.CommonActionsManager) DataManager(com.intellij.ide.DataManager) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Splitter(com.intellij.openapi.ui.Splitter) Set(java.util.Set) com.intellij.ui(com.intellij.ui) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) Disposable(com.intellij.openapi.Disposable) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreeExpander(com.intellij.ide.TreeExpander) java.awt(java.awt) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) List(java.util.List) JBPanelWithEmptyText(com.intellij.ui.components.JBPanelWithEmptyText) RunDashboardTreeStructure(com.intellij.execution.dashboard.tree.RunDashboardTreeStructure) ApplicationManager(com.intellij.openapi.application.ApplicationManager) ObjectUtils(com.intellij.util.ObjectUtils) NotNull(org.jetbrains.annotations.NotNull) TreeExpansionListener(javax.swing.event.TreeExpansionListener) javax.swing(javax.swing) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) TreeExpander(com.intellij.ide.TreeExpander) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander)

Example 2 with DefaultTreeExpander

use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.

the class SourceItemsTree method createPopupGroup.

private ActionGroup createPopupGroup() {
    final DefaultActionGroup group = new DefaultActionGroup();
    group.add(new PutSourceItemIntoDefaultLocationAction(this, myArtifactsEditor));
    group.add(new PackAndPutIntoDefaultLocationAction(this, myArtifactsEditor));
    group.add(new PutSourceItemIntoParentAndLinkViaManifestAction(this, myArtifactsEditor));
    group.add(new ExtractIntoDefaultLocationAction(this, myArtifactsEditor));
    group.add(Separator.getInstance());
    group.add(new SourceItemNavigateAction(this));
    group.add(new SourceItemFindUsagesAction(this, myArtifactsEditor.getContext().getProject(), myArtifactsEditor.getContext().getParent()));
    DefaultTreeExpander expander = new DefaultTreeExpander(this);
    final CommonActionsManager commonActionsManager = CommonActionsManager.getInstance();
    group.add(Separator.getInstance());
    group.addAction(commonActionsManager.createExpandAllAction(expander, this));
    group.addAction(commonActionsManager.createCollapseAllAction(expander, this));
    return group;
}
Also used : CommonActionsManager(com.intellij.ide.CommonActionsManager) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander)

Example 3 with DefaultTreeExpander

use of com.intellij.ide.DefaultTreeExpander in project android by JetBrains.

the class ToolWindowAlikePanel method createTreePanel.

@NotNull
public static ToolWindowAlikePanel createTreePanel(@NotNull String title, @NotNull JTree tree) {
    ToolWindowAlikePanel panel = new ToolWindowAlikePanel(title, createScrollPane(tree));
    Object root = tree.getModel().getRoot();
    if (root instanceof TreeNode && ((TreeNode) root).getChildCount() > 0) {
        TreeExpander expander = new DefaultTreeExpander(tree);
        CommonActionsManager actions = CommonActionsManager.getInstance();
        AnAction expandAllAction = actions.createExpandAllAction(expander, tree);
        expandAllAction.getTemplatePresentation().setIcon(ExpandAll);
        AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree);
        collapseAllAction.getTemplatePresentation().setIcon(CollapseAll);
        panel.setAdditionalTitleActions(expandAllAction, collapseAllAction);
    }
    return panel;
}
Also used : TreeExpander(com.intellij.ide.TreeExpander) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) TreeNode(javax.swing.tree.TreeNode) CommonActionsManager(com.intellij.ide.CommonActionsManager) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) AnAction(com.intellij.openapi.actionSystem.AnAction) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with DefaultTreeExpander

use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.

the class HierarchyBrowserBase method getData.

@Override
@Nullable
public Object getData(@NonNls final String dataId) {
    if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
        final PsiElement anElement = getSelectedElement();
        return anElement != null && anElement.isValid() ? anElement : super.getData(dataId);
    }
    if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
        return getSelectedElements();
    }
    if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
        return null;
    }
    if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
        final DefaultMutableTreeNode selectedNode = getSelectedNode();
        if (selectedNode == null)
            return null;
        final HierarchyNodeDescriptor descriptor = getDescriptor(selectedNode);
        if (descriptor == null)
            return null;
        return getNavigatable(descriptor);
    }
    if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
        return getNavigatables();
    }
    if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) {
        final JTree tree = getCurrentTree();
        if (tree != null) {
            return new DefaultTreeExpander(tree);
        }
    }
    return super.getData(dataId);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) PsiElement(com.intellij.psi.PsiElement) NavigatablePsiElement(com.intellij.psi.NavigatablePsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with DefaultTreeExpander

use of com.intellij.ide.DefaultTreeExpander in project intellij-community by JetBrains.

the class ChooseLibrariesDialogBase method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    final DefaultActionGroup group = new DefaultActionGroup();
    final TreeExpander expander = new DefaultTreeExpander(myTree);
    final CommonActionsManager actionsManager = CommonActionsManager.getInstance();
    group.add(actionsManager.createExpandAllAction(expander, myTree));
    group.add(actionsManager.createCollapseAllAction(expander, myTree));
    final JComponent component = ActionManager.getInstance().createActionToolbar(ActionPlaces.PROJECT_VIEW_TOOLBAR, group, true).getComponent();
    component.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.darkGray), component.getBorder()));
    return component;
}
Also used : DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) TreeExpander(com.intellij.ide.TreeExpander) CommonActionsManager(com.intellij.ide.CommonActionsManager) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Aggregations

DefaultTreeExpander (com.intellij.ide.DefaultTreeExpander)8 CommonActionsManager (com.intellij.ide.CommonActionsManager)7 TreeExpander (com.intellij.ide.TreeExpander)3 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 NotNull (org.jetbrains.annotations.NotNull)2 ExecutionBundle (com.intellij.execution.ExecutionBundle)1 DashboardGrouper (com.intellij.execution.dashboard.tree.DashboardGrouper)1 RunDashboardTreeStructure (com.intellij.execution.dashboard.tree.RunDashboardTreeStructure)1 DataManager (com.intellij.ide.DataManager)1 com.intellij.ide.util.treeView (com.intellij.ide.util.treeView)1 ActionPresentation (com.intellij.ide.util.treeView.smartTree.ActionPresentation)1 Disposable (com.intellij.openapi.Disposable)1 com.intellij.openapi.actionSystem (com.intellij.openapi.actionSystem)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 ActionToolbarImpl (com.intellij.openapi.actionSystem.impl.ActionToolbarImpl)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 DumbAware (com.intellij.openapi.project.DumbAware)1 Project (com.intellij.openapi.project.Project)1 Splitter (com.intellij.openapi.ui.Splitter)1