Search in sources :

Example 16 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project android by JetBrains.

the class OpenAndroidSdkManagerHyperlink method execute.

@Override
protected void execute(@NotNull Project project) {
    ActionManager actionManager = ActionManager.getInstance();
    AnAction sdkManagerAction = actionManager.getAction("Android.RunAndroidSdkManager");
    sdkManagerAction.actionPerformed(null);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 17 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project flutter-intellij by flutter.

the class FlutterStudioStartupActivity method replaceAction.

public static void replaceAction(@NotNull String actionId, @NotNull AnAction newAction) {
    ActionManager actionManager = ActionManager.getInstance();
    AnAction oldAction = actionManager.getAction(actionId);
    if (oldAction != null) {
        newAction.getTemplatePresentation().setIcon(oldAction.getTemplatePresentation().getIcon());
        newAction.getTemplatePresentation().setText(oldAction.getTemplatePresentation().getTextWithMnemonic(), true);
        newAction.getTemplatePresentation().setDescription(oldAction.getTemplatePresentation().getDescription());
        actionManager.unregisterAction(actionId);
    }
    actionManager.registerAction(actionId, newAction);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 18 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project evosuite by EvoSuite.

the class ApplicationRegistration method initComponent.

@Override
public void initComponent() {
    EvoAction evo = new EvoAction();
    // Gets an instance of the WindowMenu action group.
    // DefaultActionGroup windowM = (DefaultActionGroup) am.getAction("WindowMenu");
    // this in the file editor, not the left-pane file selection
    // DefaultActionGroup editorM = (DefaultActionGroup) am.getAction("EditorPopupMenu");
    ActionManager am = ActionManager.getInstance();
    DefaultActionGroup pvM = (DefaultActionGroup) am.getAction("ProjectViewPopupMenu");
    pvM.addSeparator();
    pvM.add(evo);
    DefaultActionGroup epM = (DefaultActionGroup) am.getAction("EditorPopupMenu");
    epM.addSeparator();
    epM.add(evo);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 19 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project evosuite by EvoSuite.

the class ProjectRegistration method projectOpened.

@Override
public void projectOpened() {
    EvoParameters.getInstance().load(project);
    ActionManager am = ActionManager.getInstance();
    // create the tool window, which will appear in the bottom when an EvoSuite run is started
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = toolWindowManager.registerToolWindow("EvoSuite", false, ToolWindowAnchor.BOTTOM);
    toolWindow.setTitle("EvoSuite Console Output");
    toolWindow.setType(ToolWindowType.DOCKED, null);
    // create a console panel
    console = (ConsoleViewImpl) TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    JComponent consolePanel = console.getComponent();
    IntelliJNotifier notifier = IntelliJNotifier.registerNotifier(project, "EvoSuite Plugin", console);
    // create left-toolbar with stop button
    DefaultActionGroup buttonGroup = new DefaultActionGroup();
    buttonGroup.add(new StopEvoAction(notifier));
    ActionToolbar viewToolbar = am.createActionToolbar("EvoSuite.ConsoleToolbar", buttonGroup, false);
    JComponent toolBarPanel = viewToolbar.getComponent();
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(toolBarPanel, BorderLayout.WEST);
    panel.add(consolePanel, BorderLayout.CENTER);
    // Content content = contentFactory.createContent(consolePanel, "", false);
    Content content = contentFactory.createContent(panel, "", false);
    toolWindow.getContentManager().addContent(content);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) ContentFactory(com.intellij.ui.content.ContentFactory)

Example 20 with ActionManager

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

the class CloudDebugProcessTest method assertRemoveFromLeftToolbar.

private void assertRemoveFromLeftToolbar(String actionId) {
    ActionManager manager = ActionManager.getInstance();
    AnAction action = manager.getAction(actionId);
    List<AnAction> leftToolbarActions = Lists.newArrayList();
    leftToolbarActions.add(action);
    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(1, leftToolbar.getChildrenCount());
    AnAction actual = leftToolbar.getChildActionsOrStubs()[0];
    assertEquals("Stop IDE Debugging. (Exit debug mode and continue the debug session later.)", actual.toString());
}
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