Example usage for com.intellij.openapi.actionSystem ActionPlaces PROJECT_VIEW_TOOLBAR

List of usage examples for com.intellij.openapi.actionSystem ActionPlaces PROJECT_VIEW_TOOLBAR

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem ActionPlaces PROJECT_VIEW_TOOLBAR.

Prototype

String PROJECT_VIEW_TOOLBAR

To view the source code for com.intellij.openapi.actionSystem ActionPlaces PROJECT_VIEW_TOOLBAR.

Click Source Link

Usage

From source file:com.intellij.util.ui.classpath.ChooseLibrariesDialogBase.java

License:Apache License

@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;
}

From source file:com.intellij.util.xml.ui.AbstractTableView.java

License:Apache License

public final void setToolbarActions(final AnAction... actions) {
    final DefaultActionGroup actionGroup = new DefaultActionGroup();
    for (final AnAction action : actions) {
        actionGroup.add(action);/*from  w  w w. ja  v a2  s .co m*/
    }
    if (getHelpId() != null) {
        actionGroup.add(AnSeparator.getInstance());
        actionGroup.add(new ContextHelpAction(getHelpId()));
    }

    final ActionManager actionManager = ActionManager.getInstance();
    final ToolbarPosition position = getToolbarPosition();
    final ActionToolbar myActionToolbar = actionManager.createActionToolbar(ActionPlaces.PROJECT_VIEW_TOOLBAR,
            actionGroup, position == ToolbarPosition.TOP || position == ToolbarPosition.BOTTOM);
    myActionToolbar.setTargetComponent(myInnerPanel);
    final JComponent toolbarComponent = myActionToolbar.getComponent();
    final MatteBorder matteBorder = BorderFactory.createMatteBorder(0, 0,
            position == ToolbarPosition.TOP ? 1 : 0, 0, JBColor.DARK_GRAY);
    toolbarComponent.setBorder(BorderFactory.createCompoundBorder(matteBorder, toolbarComponent.getBorder()));

    getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            myActionToolbar.updateActionsImmediately();
        }
    });

    add(toolbarComponent, position.getPosition());
}