Search in sources :

Example 36 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project azure-tools-for-java by Microsoft.

the class HDInsightActionsComponent method initComponent.

@Override
public void initComponent() {
    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup projectPopupGroup = (DefaultActionGroup) actionManager.getAction(IdeActions.GROUP_PROJECT_VIEW_POPUP);
    projectPopupGroup.add(actionManager.getAction("Actions.SubmitSparkApplicationAction"));
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 37 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager 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)

Example 38 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudDebugProcess method registerAdditionalActions.

@Override
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) {
    ActionManager manager = ActionManager.getInstance();
    leftToolbar.add(new SaveAndExitAction(), new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));
    leftToolbar.remove(manager.getAction(IdeActions.ACTION_RERUN));
    leftToolbar.remove(manager.getAction(IdeActions.ACTION_STOP_PROGRAM));
    // XDebugSessionTab puts this action second from end.
    AnAction[] actions = leftToolbar.getChildActionsOrStubs();
    for (AnAction action : actions) {
        String text = action.getTemplatePresentation().getText();
        if (ExecutionBundle.message("close.tab.action.name").equals(text)) {
            leftToolbar.remove(action);
            break;
        }
    }
    // https://github.com/GoogleCloudPlatform/gcloud-intellij/issues/149
    for (AnAction child : leftToolbar.getChildActionsOrStubs()) {
        if (child.getClass().getCanonicalName().equalsIgnoreCase("com.intellij.ide.actions.ContextHelpAction")) {
            // we never want to show IDEA's help.
            leftToolbar.remove(child);
            // show our help if we have it.
            String helpUrl = GctBundle.getString("clouddebug.helpurl");
            if (!"".equals(helpUrl)) {
                leftToolbar.add(new CloudDebugHelpAction(helpUrl));
            }
            break;
        }
    }
    leftToolbar.remove(manager.getAction(XDebuggerActions.RESUME));
    leftToolbar.remove(manager.getAction(XDebuggerActions.PAUSE));
    leftToolbar.remove(manager.getAction(XDebuggerActions.MUTE_BREAKPOINTS));
    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_OVER));
    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_INTO));
    topToolbar.remove(manager.getAction(XDebuggerActions.FORCE_STEP_INTO));
    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_OUT));
    topToolbar.remove(manager.getAction(XDebuggerActions.RUN_TO_CURSOR));
    topToolbar.remove(manager.getAction(XDebuggerActions.EVALUATE_EXPRESSION));
    topToolbar.remove(manager.getAction(DebuggerActions.POP_FRAME));
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) CloudDebugHelpAction(com.google.cloud.tools.intellij.debugger.actions.CloudDebugHelpAction) Constraints(com.intellij.openapi.actionSystem.Constraints) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 39 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudDebugProcessTest method testRegisterAdditionalActions_close.

public void testRegisterAdditionalActions_close() {
    ActionManager manager = ActionManager.getInstance();
    AnAction action0 = manager.getAction(IdeActions.ACTION_PIN_ACTIVE_TAB);
    AnAction action1 = manager.getAction(IdeActions.ACTION_CLOSE);
    action1.getTemplatePresentation().setText("Close");
    AnAction action2 = manager.getAction(IdeActions.ACTION_CONTEXT_HELP);
    AnAction action3 = manager.getAction(IdeActions.ACTION_CALL_HIERARCHY);
    List<AnAction> leftToolbarActions = Lists.newArrayList();
    leftToolbarActions.add(action0);
    leftToolbarActions.add(action1);
    leftToolbarActions.add(action2);
    leftToolbarActions.add(action3);
    DefaultActionGroup leftToolbar = new DefaultActionGroup(leftToolbarActions);
    List<AnAction> actions = Lists.newArrayList();
    DefaultActionGroup topToolbar = new DefaultActionGroup(actions);
    DefaultActionGroup settings = new DefaultActionGroup(actions);
    process.registerAdditionalActions(leftToolbar, topToolbar, settings);
    assertEquals(4, leftToolbar.getChildrenCount());
    assertEquals(action0, leftToolbar.getChildActionsOrStubs()[0]);
    assertEquals(action3, leftToolbar.getChildActionsOrStubs()[1]);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) AnAction(com.intellij.openapi.actionSystem.AnAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 40 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudDebugProcessTest method assertRemoveFromTopToolbar.

private void assertRemoveFromTopToolbar(String actionId) {
    ActionManager manager = ActionManager.getInstance();
    AnAction action = manager.getAction(actionId);
    List<AnAction> topToolbarActions = Lists.newArrayList();
    topToolbarActions.add(action);
    DefaultActionGroup topToolbar = new DefaultActionGroup(topToolbarActions);
    List<AnAction> actions = Lists.newArrayList();
    DefaultActionGroup leftToolbar = new DefaultActionGroup(actions);
    DefaultActionGroup settings = new DefaultActionGroup(actions);
    process.registerAdditionalActions(leftToolbar, topToolbar, settings);
    assertEmpty(topToolbar.getChildActionsOrStubs());
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) AnAction(com.intellij.openapi.actionSystem.AnAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Aggregations

ActionManager (com.intellij.openapi.actionSystem.ActionManager)43 AnAction (com.intellij.openapi.actionSystem.AnAction)27 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)15 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)4 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)4 MouseEvent (java.awt.event.MouseEvent)4 Keymap (com.intellij.openapi.keymap.Keymap)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 ActionPopupMenu (com.intellij.openapi.actionSystem.ActionPopupMenu)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)2 Presentation (com.intellij.openapi.actionSystem.Presentation)2 ActionManagerImpl (com.intellij.openapi.actionSystem.impl.ActionManagerImpl)2 Application (com.intellij.openapi.application.Application)2 ToolWindow (com.intellij.openapi.wm.ToolWindow)2 IntellijAzureActionManager (com.microsoft.azure.toolkit.intellij.common.action.IntellijAzureActionManager)2 File (java.io.File)2 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)1 CloudDebugHelpAction (com.google.cloud.tools.intellij.debugger.actions.CloudDebugHelpAction)1 DataManager (com.intellij.ide.DataManager)1