Search in sources :

Example 6 with ActionToolbarImpl

use of com.intellij.openapi.actionSystem.impl.ActionToolbarImpl in project intellij-community by JetBrains.

the class SearchReplaceComponent method createSearchToolbar1.

@NotNull
private ActionToolbarImpl createSearchToolbar1(@NotNull DefaultActionGroup group) {
    ActionToolbarImpl toolbar = createToolbar(group);
    toolbar.setForceMinimumSize(true);
    toolbar.setReservePlaceAutoPopupIcon(false);
    toolbar.setSecondaryButtonPopupStateModifier(mySearchToolbar1PopupStateModifier);
    toolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")");
    new ShowMoreOptions(toolbar, mySearchFieldWrapper);
    return toolbar;
}
Also used : ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl) ShowMoreOptions(com.intellij.find.editorHeaderActions.ShowMoreOptions) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with ActionToolbarImpl

use of com.intellij.openapi.actionSystem.impl.ActionToolbarImpl in project intellij-community by JetBrains.

the class RunConfigurationComboBoxFixture method find.

@NotNull
static RunConfigurationComboBoxFixture find(@NotNull final IdeFrameFixture parent) {
    ComponentFinder finder = parent.robot().finder();
    ActionToolbarImpl toolbar = finder.find(parent.target(), new GenericTypeMatcher<ActionToolbarImpl>(ActionToolbarImpl.class) {

        @Override
        protected boolean isMatching(@NotNull ActionToolbarImpl toolbar) {
            String place = field("myPlace").ofType(String.class).in(toolbar).get();
            return MAIN_TOOLBAR.equals(place);
        }
    });
    JButton button = finder.find(toolbar, new GenericTypeMatcher<JButton>(JButton.class) {

        @Override
        protected boolean isMatching(@NotNull JButton button) {
            return button.getClass().getSimpleName().equals("ComboBoxButton");
        }
    });
    return new RunConfigurationComboBoxFixture(parent.robot(), button);
}
Also used : ComponentFinder(org.fest.swing.core.ComponentFinder) ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with ActionToolbarImpl

use of com.intellij.openapi.actionSystem.impl.ActionToolbarImpl in project intellij-community by JetBrains.

the class ContextMenuImpl method createComponent.

private JComponent createComponent() {
    myActionToolbar = new ActionToolbarImpl(ActionPlaces.CONTEXT_TOOLBAR, myActionGroup, true, DataManager.getInstance(), ActionManagerEx.getInstanceEx(), KeymapManagerEx.getInstanceEx());
    myActionToolbar.setTargetComponent(myEditor.getContentComponent());
    myActionToolbar.setMinimumButtonSize(new Dimension(22, 22));
    myActionToolbar.setReservePlaceAutoPopupIcon(false);
    ContextMenuPanel contextMenuPanel = new ContextMenuPanel(this);
    contextMenuPanel.setLayout(new BorderLayout(0, 0));
    JComponent toolbarComponent = myActionToolbar.getComponent();
    toolbarComponent.setOpaque(false);
    contextMenuPanel.add(toolbarComponent);
    return contextMenuPanel;
}
Also used : ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl)

Example 9 with ActionToolbarImpl

use of com.intellij.openapi.actionSystem.impl.ActionToolbarImpl in project intellij-community by JetBrains.

the class TaskUiTest method testTaskComboVisible.

public void testTaskComboVisible() throws Exception {
    SwitchTaskAction combo = null;
    ActionGroup group = (ActionGroup) CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_MAIN_TOOLBAR);
    ActionToolbarImpl toolbar = (ActionToolbarImpl) ActionManager.getInstance().createActionToolbar(ActionPlaces.MAIN_TOOLBAR, group, true);
    AnAction[] children = group.getChildren(new TestActionEvent());
    for (AnAction child : children) {
        if (child instanceof ActionGroup) {
            AnAction[] actions = ((ActionGroup) child).getChildren(new TestActionEvent());
            for (AnAction action : actions) {
                if (action instanceof SwitchTaskAction) {
                    combo = (SwitchTaskAction) action;
                }
            }
        }
    }
    TaskManager manager = TaskManager.getManager(getProject());
    LocalTask defaultTask = manager.getActiveTask();
    assertTrue(defaultTask.isDefault());
    assertEquals(defaultTask.getCreated(), defaultTask.getUpdated());
    Presentation presentation = doTest(combo, toolbar);
    assertFalse(presentation.isVisible());
    try {
        TaskSettings.getInstance().ALWAYS_DISPLAY_COMBO = true;
        presentation = doTest(combo, toolbar);
        assertTrue(presentation.isVisible());
    } finally {
        TaskSettings.getInstance().ALWAYS_DISPLAY_COMBO = false;
    }
    LocalTask task = manager.createLocalTask("test");
    manager.activateTask(task, false);
    presentation = doTest(combo, toolbar);
    assertTrue(presentation.isVisible());
    manager.activateTask(defaultTask, false);
    task = manager.getActiveTask();
    assertTrue(task.isDefault());
    presentation = doTest(combo, toolbar);
    if (!presentation.isVisible()) {
        LocalTask activeTask = manager.getActiveTask();
        System.out.println(activeTask);
        System.out.println(activeTask.getCreated());
        System.out.println(activeTask.getUpdated());
        fail();
    }
}
Also used : SwitchTaskAction(com.intellij.tasks.actions.SwitchTaskAction) ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl) TestActionEvent(com.intellij.testFramework.TestActionEvent)

Example 10 with ActionToolbarImpl

use of com.intellij.openapi.actionSystem.impl.ActionToolbarImpl in project intellij-plugins by JetBrains.

the class SplitEditorToolbar method createToolbarFromGroupId.

@NotNull
private static ActionToolbar createToolbarFromGroupId(@NotNull String groupId) {
    final ActionManager actionManager = ActionManager.getInstance();
    if (!actionManager.isGroup(groupId)) {
        throw new IllegalStateException(groupId + " should have been a group");
    }
    final ActionGroup group = ((ActionGroup) actionManager.getAction(groupId));
    final ActionToolbarImpl editorToolbar = ((ActionToolbarImpl) actionManager.createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true));
    editorToolbar.setOpaque(false);
    editorToolbar.setBorder(new JBEmptyBorder(0, 2, 0, 2));
    return editorToolbar;
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) JBEmptyBorder(com.intellij.util.ui.JBEmptyBorder) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ActionToolbarImpl (com.intellij.openapi.actionSystem.impl.ActionToolbarImpl)10 NotNull (org.jetbrains.annotations.NotNull)5 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2 ShowMoreOptions (com.intellij.find.editorHeaderActions.ShowMoreOptions)1 CommonActionsManager (com.intellij.ide.CommonActionsManager)1 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)1 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 SwitchTaskAction (com.intellij.tasks.actions.SwitchTaskAction)1 TestActionEvent (com.intellij.testFramework.TestActionEvent)1 JBLabel (com.intellij.ui.components.JBLabel)1 JBEmptyBorder (com.intellij.util.ui.JBEmptyBorder)1 Border (javax.swing.border.Border)1 EmptyBorder (javax.swing.border.EmptyBorder)1 ComponentFinder (org.fest.swing.core.ComponentFinder)1