Search in sources :

Example 6 with CommonActionsManager

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

the class ProjectProfileSelectionDialog method createTreePanel.

@NotNull
static JPanel createTreePanel(@NotNull CheckboxTreeView tree) {
    JPanel treePanel = new JPanel(new BorderLayout());
    DefaultActionGroup group = new DefaultActionGroup();
    CommonActionsManager actions = CommonActionsManager.getInstance();
    group.addAll(actions.createExpandAllAction(tree, treePanel), actions.createCollapseAllAction(tree, treePanel));
    ActionToolbar actionToolBar = ActionManager.getInstance().createActionToolbar("AndroidProjectProfileSelection", group, true);
    JPanel buttonsPanel = new JPanel(new BorderLayout());
    buttonsPanel.add(actionToolBar.getComponent(), BorderLayout.CENTER);
    buttonsPanel.setBorder(new SideBorder(JBColor.border(), SideBorder.TOP | SideBorder.LEFT | SideBorder.RIGHT, 1));
    treePanel.add(buttonsPanel, BorderLayout.NORTH);
    treePanel.add(ScrollPaneFactory.createScrollPane(tree), BorderLayout.CENTER);
    return treePanel;
}
Also used : CommonActionsManager(com.intellij.ide.CommonActionsManager) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with CommonActionsManager

use of com.intellij.ide.CommonActionsManager 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 8 with CommonActionsManager

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

the class SpecificFilesViewDialog method createPanel.

private void createPanel() {
    myPanel = new JPanel(new BorderLayout());
    final DefaultActionGroup group = new DefaultActionGroup();
    final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("SPECIFIC_FILES_DIALOG", group, true);
    addCustomActions(group, actionToolbar);
    final CommonActionsManager cam = CommonActionsManager.getInstance();
    final Expander expander = new Expander();
    group.addSeparator();
    group.add(new ToggleShowFlattenAction());
    group.add(cam.createExpandAllAction(expander, myView));
    group.add(cam.createCollapseAllAction(expander, myView));
    myPanel.add(actionToolbar.getComponent(), BorderLayout.NORTH);
    myPanel.add(ScrollPaneFactory.createScrollPane(myView), BorderLayout.CENTER);
    myView.setShowFlatten(false);
}
Also used : TreeExpander(com.intellij.ide.TreeExpander) CommonActionsManager(com.intellij.ide.CommonActionsManager)

Example 9 with CommonActionsManager

use of com.intellij.ide.CommonActionsManager 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)

Example 10 with CommonActionsManager

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

the class IntentionSettingsTree method initTree.

private void initTree() {
    myTree = new CheckboxTree(new CheckboxTree.CheckboxTreeCellRenderer(true) {

        @Override
        public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
            if (!(value instanceof CheckedTreeNode))
                return;
            CheckedTreeNode node = (CheckedTreeNode) value;
            SimpleTextAttributes attributes = node.getUserObject() instanceof IntentionActionMetaData ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
            final String text = getNodeText(node);
            final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
            UIUtil.changeBackGround(this, background);
            if (text != null) {
                SearchUtil.appendFragments(myFilter != null ? myFilter.getFilter() : null, text, attributes.getStyle(), attributes.getFgColor(), background, getTextRenderer());
            }
        }
    }, new CheckedTreeNode(null));
    myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getPath();
            Object userObject = ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
            selectionChanged(userObject);
        }
    });
    myFilter = new MyFilterComponent();
    myComponent = new JPanel(new BorderLayout());
    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
    myNorthPanel = new JPanel(new BorderLayout());
    myNorthPanel.add(myFilter, BorderLayout.CENTER);
    final DefaultActionGroup group = new DefaultActionGroup();
    final CommonActionsManager actionManager = CommonActionsManager.getInstance();
    final DefaultTreeExpander treeExpander = new DefaultTreeExpander(myTree);
    group.add(actionManager.createExpandAllAction(treeExpander, myTree));
    group.add(actionManager.createCollapseAllAction(treeExpander, myTree));
    myNorthPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true).getComponent(), BorderLayout.WEST);
    myComponent.add(myNorthPanel, BorderLayout.NORTH);
    myComponent.add(scrollPane, BorderLayout.CENTER);
    myFilter.reset();
}
Also used : TreeSelectionListener(javax.swing.event.TreeSelectionListener) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) TreePath(javax.swing.tree.TreePath) CommonActionsManager(com.intellij.ide.CommonActionsManager) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent)

Aggregations

CommonActionsManager (com.intellij.ide.CommonActionsManager)13 TreeExpander (com.intellij.ide.TreeExpander)7 DefaultTreeExpander (com.intellij.ide.DefaultTreeExpander)5 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)4 NotNull (org.jetbrains.annotations.NotNull)3 FilterComponent (com.intellij.ui.FilterComponent)2 Alarm (com.intellij.util.Alarm)2 TreePath (javax.swing.tree.TreePath)2 ConsoleActionsPostProcessor (com.intellij.execution.actions.ConsoleActionsPostProcessor)1 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 ActionToolbarImpl (com.intellij.openapi.actionSystem.impl.ActionToolbarImpl)1 ScrollToTheEndToolbarAction (com.intellij.openapi.editor.actions.ScrollToTheEndToolbarAction)1 ToggleUseSoftWrapsToolbarAction (com.intellij.openapi.editor.actions.ToggleUseSoftWrapsToolbarAction)1 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 ArrayList (java.util.ArrayList)1 EmptyBorder (javax.swing.border.EmptyBorder)1 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)1 TreeSelectionListener (javax.swing.event.TreeSelectionListener)1