Search in sources :

Example 31 with ActionManager

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

the class MavenUIUtil method executeAction.

public static void executeAction(final String actionId, final InputEvent e) {
    final ActionManager actionManager = ActionManager.getInstance();
    final AnAction action = actionManager.getAction(actionId);
    if (action != null) {
        final Presentation presentation = new Presentation();
        final AnActionEvent event = new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation, actionManager, 0);
        action.update(event);
        if (presentation.isEnabled()) {
            action.actionPerformed(event);
        }
    }
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) Presentation(com.intellij.openapi.actionSystem.Presentation) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 32 with ActionManager

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

the class SelectionTool method handlePopup.

@Override
protected void handlePopup() {
    ActionManager actionManager = ActionManager.getInstance();
    ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(myArea.getPopupPlace(), myArea.getPopupActions());
    MouseEvent event = (MouseEvent) myInputEvent;
    popupMenu.getComponent().show(myArea.getNativeComponent(), event.getX(), event.getY());
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) MouseEvent(java.awt.event.MouseEvent) ActionPopupMenu(com.intellij.openapi.actionSystem.ActionPopupMenu)

Example 33 with ActionManager

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

the class ApplicationLoader method installValidateXmlAction.

private static void installValidateXmlAction() {
    final ActionManager mgr = ActionManager.getInstance();
    final AnAction validateAction = mgr.getAction(VALIDATE_XML);
    mgr.unregisterAction(VALIDATE_XML);
    mgr.registerAction(VALIDATE_XML, new ValidateAction(validateAction));
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ValidateAction(org.intellij.plugins.relaxNG.validation.ValidateAction) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 34 with ActionManager

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

the class AzureActionsComponent method initComponent.

public void initComponent() {
    if (!AzurePlugin.IS_ANDROID_STUDIO) {
        initAuthManage();
        ActionManager am = ActionManager.getInstance();
        DefaultActionGroup toolbarGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_MAIN_TOOLBAR);
        toolbarGroup.addAll((DefaultActionGroup) am.getAction("AzureToolbarGroup"));
        DefaultActionGroup popupGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_PROJECT_VIEW_POPUP);
        popupGroup.add(am.getAction("AzurePopupGroup"));
        if (PlatformUtils.isIdeaUltimate()) {
            ActionManager actionManager = ActionManager.getInstance();
            DefaultActionGroup actionGroup = (DefaultActionGroup) actionManager.getAction("PublishGroup");
            if (actionGroup != null)
                actionGroup.addAll((ActionGroup) actionManager.getAction("AzureWebDeployGroup"));
        }
    }
    try {
        PlatformDependent.isAndroid();
    } catch (Throwable ignored) {
        DefaultLoader.getUIHelper().showError("A problem with your Android Support plugin setup is preventing the Azure Toolkit from functioning correctly (Retrofit2 and RxJava failed to initialize).\n" + "To fix this issue, try disabling the Android Support plugin or installing the Android SDK", "Azure Toolkit for IntelliJ");
    //            DefaultLoader.getUIHelper().showException("Android Support Error: isAndroid() throws " + ignored.getMessage(), ignored, "Error Android", true, false);
    }
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 35 with ActionManager

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

the class CreateElixirModuleActionTest method checkModuleFile.

private void checkModuleFile(final String moduleName, String path) throws IOException {
    ActionManager actionManager = ActionManager.getInstance();
    final CreateElixirModuleAction elixirNewFileAction = (CreateElixirModuleAction) actionManager.getAction("Elixir.NewFile");
    // @see https://devnet.jetbrains.com/message/5539349#5539349
    VirtualFile directoryVirtualFile = myFixture.getTempDirFixture().findOrCreateDir("");
    final PsiDirectory directory = myFixture.getPsiManager().findDirectory(directoryVirtualFile);
    Application application = ApplicationManager.getApplication();
    application.runWriteAction(new Runnable() {

        @Override
        public void run() {
            ElixirFile file = elixirNewFileAction.createFile(moduleName, TEMPLATE_NAME, directory);
            assertNotNull("Expected CreateElixirModuleAction.createFile to create an ElixirFile", file);
        }
    });
    boolean ignoreTrailingWhitespaces = true;
    myFixture.checkResultByFile(path, path, ignoreTrailingWhitespaces);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiDirectory(com.intellij.psi.PsiDirectory) Application(com.intellij.openapi.application.Application) ElixirFile(org.elixir_lang.psi.ElixirFile)

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