Example usage for com.intellij.openapi.actionSystem DefaultActionGroup addAction

List of usage examples for com.intellij.openapi.actionSystem DefaultActionGroup addAction

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem DefaultActionGroup addAction.

Prototype

@NotNull
    public final ActionInGroup addAction(@NotNull AnAction action) 

Source Link

Usage

From source file:automation.RobotControlWindow.java

License:Apache License

public RobotControlWindow(@NotNull final Component component) throws HeadlessException {
    super(findWindow(component));

    myRobotControl = RobotControlManager.getInstance().getRobotControl();

    Window window = findWindow(component);
    setModal(window instanceof JDialog && ((JDialog) window).isModal());
    getRootPane().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    setLayout(new BorderLayout());
    setTitle(component.getClass().getName());

    DefaultActionGroup actions = new DefaultActionGroup();
    actions.addAction(new IconWithTextAction("Push the ActionLink") {
        @Override/*from   ww  w.j av a  2s.  co m*/
        public void actionPerformed(AnActionEvent e) {
            //  Component actionLink = GuiUtil.findComponentByText("Create New Project", component);
            //  if(actionLink != null) {
            //    try {
            //      RobotControlManager.getInstance().getRobotControl().navigateAndClickScript(actionLink);
            //    }
            //    catch (InterruptedException e1) {
            //      e1.printStackTrace();
            //    }
            //    catch (Exception e1) {
            //      e1.printStackTrace();
            //    }
            //  }
            //}
            try {
                ScriptProcessor.process();
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }

        @Override
        public void update(AnActionEvent e) {
            //do nothing
        }
    });

    //actions.addSeparator();

    //actions.add(new IconWithTextAction("Refresh") {
    //
    // @Override
    // public void actionPerformed(AnActionEvent e) {
    //   getCurrentTable().refresh();
    // }
    //
    // @Override
    // public void update(AnActionEvent e) {
    //   e.getPresentation().setEnabled(myComponent != null && myComponent.isVisible());
    // }
    //});

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.CONTEXT_TOOLBAR,
            actions, true);
    add(toolbar.getComponent(), BorderLayout.NORTH);
    statusLabel = new JLabel("Ok");
    add(statusLabel);

    myWrapperPanel = new JPanel(new BorderLayout());

    //myHierarchyTree = new HierarchyTree(component) {
    //  @Override
    //  public void onComponentChanged(Component c) {
    //    boolean wasHighlighted = myHighlightComponent != null;
    //    setHighlightingEnabled(false);
    //    switchInfo(c);
    //    setHighlightingEnabled(wasHighlighted);
    //  }
    //};

    //myWrapperPanel.add(myInspectorTable, BorderLayout.CENTER);

    //JSplitPane splitPane = new JSplitPane();
    //splitPane.setDividerLocation(0.5);
    //splitPane.setRightComponent(myWrapperPanel);

    JScrollPane pane = new JBScrollPane(myHierarchyTree);
    //splitPane.setLeftComponent(pane);
    //add(splitPane, BorderLayout.CENTER);

    //myHierarchyTree.expandPath();

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            close();
        }
    });

    getRootPane().getActionMap().put("CLOSE", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            close();
        }
    });
    //setHighlightingEnabled(true);
    getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
            .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "CLOSE");
}

From source file:com.android.tools.idea.editors.hprof.views.ClassesTreeView.java

License:Apache License

public ClassesTreeView(@NotNull Project project, @NotNull DefaultActionGroup editorActionGroup,
        @NotNull final SelectionModel selectionModel) {
    myProject = project;/*  w  w  w .  ja  v a 2 s  .c o  m*/

    myRoot = new HeapPackageNode(null, "");
    myTreeModel = new DefaultTreeModel(myRoot);
    myTree = new Tree(myTreeModel);
    myTree.setName(TREE_NAME);
    myDisplayMode = DisplayMode.LIST;
    myTree.setRootVisible(false);
    myTree.setShowsRootHandles(false);
    myTree.setLargeModel(true);

    myTree.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, this);
    JBList contextActionList = new JBList(new EditMultipleSourcesAction());
    JBPopupFactory.getInstance().createListPopupBuilder(contextActionList);
    final DefaultActionGroup popupGroup = new DefaultActionGroup(new EditMultipleSourcesAction());
    myTree.addMouseListener(new PopupHandler() {
        @Override
        public void invokePopup(Component comp, int x, int y) {
            ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, popupGroup).getComponent()
                    .show(comp, x, y);
        }
    });

    editorActionGroup.addAction(new ComboBoxAction() {
        @NotNull
        @Override
        protected DefaultActionGroup createPopupActionGroup(JComponent button) {
            DefaultActionGroup group = new DefaultActionGroup();
            for (final DisplayMode mode : DisplayMode.values()) {
                group.add(new AnAction(mode.toString()) {
                    @Override
                    public void actionPerformed(AnActionEvent e) {
                        myDisplayMode = mode;
                        boolean isTreeMode = myDisplayMode == DisplayMode.TREE;
                        myTree.setShowsRootHandles(isTreeMode);
                        if (isTreeMode) {
                            myTreeIndex.buildTree(mySelectedHeapId);
                        } else {
                            myListIndex.buildList(myRoot);
                        }

                        restoreViewState(selectionModel);
                    }
                });
            }
            return group;
        }

        @Override
        public void update(AnActionEvent e) {
            super.update(e);
            getTemplatePresentation().setText(myDisplayMode.toString());
            e.getPresentation().setText(myDisplayMode.toString());
        }
    });

    myListIndex = new ListIndex();
    myTreeIndex = new TreeIndex();
    selectionModel.addListener(myListIndex); // Add list index first, since that always updates; and tree index depends on it.
    selectionModel.addListener(myTreeIndex);

    selectionModel.addListener(new SelectionModel.SelectionListener() {
        @Override
        public void onHeapChanged(@NotNull Heap heap) {
            mySelectedHeapId = heap.getId();

            assert myListIndex.myHeapId == mySelectedHeapId;
            if (myDisplayMode == DisplayMode.LIST) {
                myListIndex.buildList(myRoot);
            } else if (myDisplayMode == DisplayMode.TREE) {
                myTreeIndex.buildTree(mySelectedHeapId);
            }

            restoreViewState(selectionModel);
        }

        @Override
        public void onClassObjChanged(@Nullable ClassObj classObj) {
            TreeNode nodeToSelect = null;
            if (classObj != null) {
                nodeToSelect = findClassObjNode(classObj);
            }

            if (nodeToSelect != null) {
                TreePath pathToSelect = new TreePath(myTreeModel.getPathToRoot(nodeToSelect));
                myTree.setSelectionPath(pathToSelect);
                myTree.scrollPathToVisible(pathToSelect);
            }
        }

        @Override
        public void onInstanceChanged(@Nullable Instance instance) {

        }
    });

    myTree.addTreeSelectionListener(e -> {
        TreePath path = e.getPath();
        if (!e.isAddedPath()) {
            return;
        }

        if (path == null || path.getPathCount() < 2) {
            selectionModel.setClassObj(null);
            return;
        }

        assert path.getLastPathComponent() instanceof HeapNode;
        HeapNode heapNode = (HeapNode) path.getLastPathComponent();
        if (heapNode instanceof HeapClassObjNode) {
            selectionModel.setClassObj(((HeapClassObjNode) heapNode).getClassObj());
        }
    });

    ColumnTreeBuilder builder = new ColumnTreeBuilder(myTree)
            .addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Class Name").setPreferredWidth(800)
                    .setHeaderAlignment(SwingConstants.LEFT).setComparator((HeapNode a, HeapNode b) -> {
                        int valueA = a instanceof HeapPackageNode ? 0 : 1;
                        int valueB = b instanceof HeapPackageNode ? 0 : 1;
                        if (valueA != valueB) {
                            return valueA - valueB;
                        }
                        return compareNames(a, b);
                    }).setRenderer(new ColoredTreeCellRenderer() {
                        @Override
                        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected,
                                boolean expanded, boolean leaf, int row, boolean hasFocus) {
                            if (value instanceof HeapClassObjNode) {
                                ClassObj clazz = ((HeapClassObjNode) value).getClassObj();
                                String name = clazz.getClassName();
                                String pkg = null;
                                int i = name.lastIndexOf(".");
                                if (i != -1) {
                                    pkg = name.substring(0, i);
                                    name = name.substring(i + 1);
                                }
                                append(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);
                                if (pkg != null) {
                                    append(" (" + pkg + ")",
                                            new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
                                }
                                setTransparentIconBackground(true);
                                setIcon(PlatformIcons.CLASS_ICON);
                                // TODO reformat anonymous classes (ANONYMOUS_CLASS_ICON) to match IJ.
                            } else if (value instanceof HeapNode) {
                                append(((HeapNode) value).getSimpleName(),
                                        SimpleTextAttributes.REGULAR_ATTRIBUTES);
                                setTransparentIconBackground(true);
                                setIcon(PlatformIcons.PACKAGE_ICON);
                            } else {
                                append("This should not be rendered");
                            }
                        }
                    }))
            .addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Total Count").setPreferredWidth(100)
                    .setHeaderAlignment(SwingConstants.RIGHT).setComparator((HeapNode a, HeapNode b) -> {
                        int result = a.getTotalCount() - b.getTotalCount();
                        return result == 0 ? compareNames(a, b) : result;
                    }).setRenderer(new ColoredTreeCellRenderer() {
                        @Override
                        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected,
                                boolean expanded, boolean leaf, int row, boolean hasFocus) {
                            if (value instanceof HeapNode) {
                                append(Integer.toString(((HeapNode) value).getTotalCount()));
                            }
                            setTextAlign(SwingConstants.RIGHT);
                        }
                    }))
            .addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Heap Count").setPreferredWidth(100)
                    .setHeaderAlignment(SwingConstants.RIGHT).setComparator((HeapNode a, HeapNode b) -> {
                        int result = a.getHeapInstancesCount(mySelectedHeapId)
                                - b.getHeapInstancesCount(mySelectedHeapId);
                        return result == 0 ? compareNames(a, b) : result;
                    }).setRenderer(new ColoredTreeCellRenderer() {
                        @Override
                        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected,
                                boolean expanded, boolean leaf, int row, boolean hasFocus) {
                            if (value instanceof HeapNode) {
                                append(Integer
                                        .toString(((HeapNode) value).getHeapInstancesCount(mySelectedHeapId)));
                            }
                            setTextAlign(SwingConstants.RIGHT);
                        }
                    }))
            .addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Sizeof").setPreferredWidth(80)
                    .setHeaderAlignment(SwingConstants.RIGHT).setComparator((HeapNode a, HeapNode b) -> {
                        int sizeA = a.getInstanceSize();
                        int sizeB = b.getInstanceSize();
                        if (sizeA < 0 && sizeB < 0) {
                            return compareNames(a, b);
                        }
                        int result = sizeA - sizeB;
                        return result == 0 ? compareNames(a, b) : result;
                    }).setRenderer(new ColoredTreeCellRenderer() {
                        @Override
                        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected,
                                boolean expanded, boolean leaf, int row, boolean hasFocus) {
                            if (value instanceof HeapClassObjNode) {
                                append(Integer.toString(((HeapClassObjNode) value).getInstanceSize()));
                            }
                            setTextAlign(SwingConstants.RIGHT);
                        }
                    }))
            .addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Shallow Size").setPreferredWidth(100)
                    .setHeaderAlignment(SwingConstants.RIGHT).setComparator((HeapNode a, HeapNode b) -> {
                        int result = a.getShallowSize(mySelectedHeapId) - b.getShallowSize(mySelectedHeapId);
                        return result == 0 ? compareNames(a, b) : result;
                    }).setRenderer(new ColoredTreeCellRenderer() {
                        @Override
                        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected,
                                boolean expanded, boolean leaf, int row, boolean hasFocus) {
                            if (value instanceof HeapNode) {
                                append(Integer.toString(((HeapNode) value).getShallowSize(mySelectedHeapId)));
                            }
                            setTextAlign(SwingConstants.RIGHT);
                        }
                    }))
            .addColumn(new ColumnTreeBuilder.ColumnBuilder().setName("Retained Size").setPreferredWidth(120)
                    .setHeaderAlignment(SwingConstants.RIGHT).setInitialOrder(SortOrder.DESCENDING)
                    .setComparator((HeapNode a, HeapNode b) -> {
                        long result = a.getRetainedSize() - b.getRetainedSize();
                        return result == 0 ? compareNames(a, b) : (result > 0 ? 1 : -1);
                    }).setRenderer(new ColoredTreeCellRenderer() {
                        @Override
                        public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected,
                                boolean expanded, boolean leaf, int row, boolean hasFocus) {
                            if (value instanceof HeapNode) {
                                append(Long.toString(((HeapNode) value).getRetainedSize()));
                            }
                            setTextAlign(SwingConstants.RIGHT);
                        }
                    }));

    //noinspection NullableProblems
    builder.setTreeSorter(new ColumnTreeBuilder.TreeSorter<HeapNode>() {
        @Override
        public void sort(@NotNull Comparator<HeapNode> comparator, @NotNull SortOrder sortOrder) {
            if (myComparator != comparator) {
                myComparator = comparator;

                selectionModel.setSelectionLocked(true);
                TreePath selectionPath = myTree.getSelectionPath();
                sortTree(myRoot);
                myTreeModel.nodeStructureChanged(myRoot);
                myTree.setSelectionPath(selectionPath);
                myTree.scrollPathToVisible(selectionPath);
                selectionModel.setSelectionLocked(false);
            }
        }
    });

    myColumnTree = builder.build();
    installTreeSpeedSearch();
}

From source file:com.android.tools.idea.run.ExternalToolRunner.java

License:Apache License

protected void fillToolBarActions(DefaultActionGroup toolbarActions) {
    toolbarActions.addAction(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM));
}

From source file:com.favorite.HelloWorldAction.java

License:Apache License

private void addActions(@NotNull final List<AnAction> actions, @NotNull final DefaultActionGroup toGroup) {
    for (AnAction action : actions) {
        toGroup.addAction(action);
    }/*from   www.ja  v  a  2  s. co m*/
}

From source file:com.intellij.execution.junit2.ui.actions.JUnitToolbarPanel.java

License:Apache License

@Override
protected void appendAdditionalActions(DefaultActionGroup actionGroup, TestConsoleProperties properties,
        ExecutionEnvironment environment, JComponent parent) {
    super.appendAdditionalActions(actionGroup, properties, environment, parent);
    actionGroup.addAction(new ToggleBooleanProperty(
            ExecutionBundle.message("junit.runing.info.include.non.started.in.rerun.failed.action.name"), null,
            AllIcons.RunConfigurations.IncludeNonStartedTests_Rerun, properties,
            TestConsoleProperties.INCLUDE_NON_STARTED_IN_RERUN_FAILED)).setAsSecondary(true);
}

From source file:com.intellij.execution.testframework.ToolbarPanel.java

License:Apache License

public ToolbarPanel(final TestConsoleProperties properties, ExecutionEnvironment environment,
        JComponent parent) {//  w  w  w .ja v  a  2s  .c om
    super(new BorderLayout());
    final DefaultActionGroup actionGroup = new DefaultActionGroup(null, false);
    actionGroup.addAction(new ToggleBooleanProperty(
            ExecutionBundle.message("junit.run.hide.passed.action.name"),
            ExecutionBundle.message("junit.run.hide.passed.action.description"),
            AllIcons.RunConfigurations.HidePassed, properties, TestConsoleProperties.HIDE_PASSED_TESTS));
    actionGroup.addSeparator();

    actionGroup.addAction(new ToggleBooleanProperty(
            ExecutionBundle.message("junit.runing.info.track.test.action.name"),
            ExecutionBundle.message("junit.runing.info.track.test.action.description"),
            AllIcons.RunConfigurations.TrackTests, properties, TestConsoleProperties.TRACK_RUNNING_TEST))
            .setAsSecondary(true);
    actionGroup
            .addAction(new ToggleBooleanProperty(ExecutionBundle.message("junit.run.hide.ignored.action.name"),
                    null, AllIcons.RunConfigurations.HideIgnored, properties,
                    TestConsoleProperties.HIDE_IGNORED_TEST))
            .setAsSecondary(true);

    actionGroup.addAction(new ToggleBooleanProperty(
            ExecutionBundle.message("junit.runing.info.sort.alphabetically.action.name"),
            ExecutionBundle.message("junit.runing.info.sort.alphabetically.action.description"),
            AllIcons.ObjectBrowser.Sorted, properties, TestConsoleProperties.SORT_ALPHABETICALLY));
    actionGroup.addSeparator();

    AnAction action = CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, parent);
    action.getTemplatePresentation()
            .setDescription(ExecutionBundle.message("junit.runing.info.expand.test.action.name"));
    actionGroup.add(action);

    action = CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, parent);
    action.getTemplatePresentation()
            .setDescription(ExecutionBundle.message("junit.runing.info.collapse.test.action.name"));
    actionGroup.add(action);

    actionGroup.addSeparator();
    final CommonActionsManager actionsManager = CommonActionsManager.getInstance();
    myOccurenceNavigator = new FailedTestsNavigator();
    actionGroup.add(actionsManager.createPrevOccurenceAction(myOccurenceNavigator));
    actionGroup.add(actionsManager.createNextOccurenceAction(myOccurenceNavigator));

    actionGroup.addAction(new ToggleBooleanProperty(
            ExecutionBundle.message("junit.runing.info.select.first.failed.action.name"), null,
            AllIcons.RunConfigurations.SelectFirstDefect, properties,
            TestConsoleProperties.SELECT_FIRST_DEFECT)).setAsSecondary(true);
    actionGroup.addAction(new ToggleBooleanProperty(
            ExecutionBundle.message("junit.runing.info.scroll.to.stacktrace.action.name"),
            ExecutionBundle.message("junit.runing.info.scroll.to.stacktrace.action.description"),
            AllIcons.RunConfigurations.ScrollToStackTrace, properties,
            TestConsoleProperties.SCROLL_TO_STACK_TRACE)).setAsSecondary(true);
    myScrollToSource = new ScrollToTestSourceAction(properties);
    actionGroup.addAction(myScrollToSource).setAsSecondary(true);
    actionGroup.addAction(new ToggleBooleanProperty(
            ExecutionBundle.message("junit.runing.info.open.source.at.exception.action.name"),
            ExecutionBundle.message("junit.runing.info.open.source.at.exception.action.description"),
            AllIcons.RunConfigurations.SourceAtException, properties, TestConsoleProperties.OPEN_FAILURE_LINE))
            .setAsSecondary(true);

    actionGroup.addAction(new ShowStatisticsAction(properties)).setAsSecondary(true);
    actionGroup.addAction(new AdjustAutotestDelayActionGroup(environment)).setAsSecondary(true);

    for (ToggleModelActionProvider actionProvider : Extensions
            .getExtensions(ToggleModelActionProvider.EP_NAME)) {
        final ToggleModelAction toggleModelAction = actionProvider.createToggleModelAction(properties);
        myActions.add(toggleModelAction);
        actionGroup.add(toggleModelAction);
    }

    myExportAction = ExportTestResultsAction.create(properties.getExecutor().getToolWindowId(),
            properties.getConfiguration());
    actionGroup.addAction(myExportAction);

    appendAdditionalActions(actionGroup, properties, environment, parent);

    add(ActionManager.getInstance().createActionToolbar(ActionPlaces.TESTTREE_VIEW_TOOLBAR, actionGroup, true)
            .getComponent(), BorderLayout.CENTER);
}

From source file:com.intellij.find.EditorSearchComponent.java

License:Apache License

private void initToolbar() {
    DefaultActionGroup actionGroup = new DefaultActionGroup("search bar", false);
    actionGroup.add(new ShowHistoryAction(mySearchFieldGetter, this));
    actionGroup.add(new PrevOccurrenceAction(this, mySearchFieldGetter));
    actionGroup.add(new NextOccurrenceAction(this, mySearchFieldGetter));
    actionGroup.add(new AddOccurrenceAction(this));
    actionGroup.add(new RemoveOccurrenceAction(this));
    actionGroup.add(new SelectAllAction(this));
    actionGroup.add(new FindAllAction(this));
    actionGroup.add(new ToggleMultiline(this));
    actionGroup.add(new ToggleMatchCase(this));
    actionGroup.add(new ToggleRegex(this));

    myMatchInfoLabel = new JLabel();

    myClickToHighlightLabel = new LinkLabel("Click to highlight", null, new LinkListener() {
        @Override/*  ww  w .  j  a va2  s.co  m*/
        public void linkSelected(LinkLabel aSource, Object aLinkData) {
            setMatchesLimit(Integer.MAX_VALUE);
            updateResults(true);
        }
    });
    myClickToHighlightLabel.setVisible(false);

    myActionsToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, actionGroup,
            true);
    myActionsToolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")");

    actionGroup.addAction(new ToggleWholeWordsOnlyAction(this));

    actionGroup.addAction(new ToggleInCommentsAction(this)).setAsSecondary(true);
    actionGroup.addAction(new ToggleInLiteralsOnlyAction(this)).setAsSecondary(true);
    actionGroup.addAction(new ToggleExceptCommentsAction(this)).setAsSecondary(true);
    actionGroup.addAction(new ToggleExceptLiteralsAction(this)).setAsSecondary(true);
    actionGroup.addAction(new ToggleExceptCommentsAndLiteralsAction(this)).setAsSecondary(true);

    actionGroup.addAction(new TogglePreserveCaseAction(this));
    actionGroup.addAction(new ToggleSelectionOnlyAction(this));

    class MyCustomComponentDoNothingAction extends AnAction implements CustomComponentAction {
        private final JComponent c;

        MyCustomComponentDoNothingAction(JComponent c) {
            this.c = c;
            c.setBorder(IdeBorderFactory.createEmptyBorder(new Insets(0, 10, 0, 0)));
        }

        @Override
        public void actionPerformed(AnActionEvent e) {
        }

        @Override
        public JComponent createCustomComponent(Presentation presentation) {
            return c;
        }
    }
    actionGroup.add(new MyCustomComponentDoNothingAction(myMatchInfoLabel));
    actionGroup.add(new MyCustomComponentDoNothingAction(myClickToHighlightLabel));

    myActionsToolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY);
    myToolbarComponent = myActionsToolbar.getComponent();
    myToolbarComponent.setBorder(null);
    myToolbarComponent.setOpaque(false);
}

From source file:com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel.java

License:Apache License

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();

    group.add(new FavoritesFlattenPackagesAction(myProject, myBuilder));
    group.add(new FavoritesCompactEmptyMiddlePackagesAction(myProject, myBuilder));
    group.addAction(new FavoritesAbbreviatePackageNamesAction(myProject, myBuilder));

    group.add(new FavoritesShowMembersAction(myProject, myBuilder));

    final FavoritesAutoscrollFromSourceHandler handler = new FavoritesAutoscrollFromSourceHandler(myProject,
            myBuilder);/*from   w  ww .  ja  v  a  2s  .  c om*/
    handler.install();
    group.add(handler.createToggleAction());

    group.add(new FavoritesAutoScrollToSourceAction(myProject, myAutoScrollToSourceHandler, myBuilder));
    window.setAdditionalGearActions(group);
}

From source file:com.intellij.ide.plugins.AvailablePluginsManagerMain.java

License:Apache License

@Override
protected DefaultActionGroup createSortersGroup() {
    final DefaultActionGroup group = super.createSortersGroup();
    group.addAction(new SortByDownloadsAction(pluginTable, pluginsModel));
    group.addAction(new SortByRatingAction(pluginTable, pluginsModel));
    group.addAction(new SortByUpdatedAction(pluginTable, pluginsModel));
    return group;
}

From source file:com.intellij.ide.plugins.InstalledPluginsManagerMain.java

License:Apache License

@Override
protected ActionGroup getActionGroup(boolean inToolbar) {
    final DefaultActionGroup actionGroup = new DefaultActionGroup();
    if (inToolbar) {
        //actionGroup.add(new SortByStatusAction("Sort by Status"));
        actionGroup.add(new MyFilterEnabledAction());
        //actionGroup.add(new MyFilterBundleAction());
    } else {//from www  . j  a  v a2 s.  c om
        actionGroup.add(new RefreshAction());
        actionGroup.addAction(createSortersGroup());
        actionGroup.add(AnSeparator.getInstance());
        actionGroup.add(new InstallPluginAction(getAvailable(), getInstalled()));
        actionGroup.add(new UninstallPluginAction(this, pluginTable));
    }
    return actionGroup;
}