Search in sources :

Example 41 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project intellij-leiningen-plugin by derkork.

the class LeiningenNode 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 42 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project psiviewer by cmf.

the class PsiViewerProjectComponent method initToolWindow.

public void initToolWindow() {
    _viewerPanel = new PsiViewerPanel(this);
    _viewerPanel.addPropertyChangeListener("ancestor", new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            handleCurrentState();
        }
    });
    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup actionGroup = new DefaultActionGroup(ID_ACTION_GROUP, false);
    actionGroup.add(new PropertyToggleAction("Filter Whitespace", "Remove whitespace elements", Helpers.getIcon(ICON_FILTER_WHITESPACE), this, "filterWhitespace"));
    actionGroup.add(new PropertyToggleAction("Highlight", "Highlight selected PSI element", Helpers.getIcon(ICON_TOGGLE_HIGHLIGHT), this, "highlighted"));
    actionGroup.add(new PropertyToggleAction("Properties", "Show PSI element properties", AllIcons.General.Settings, this, "showProperties"));
    actionGroup.add(new PropertyToggleAction("Autoscroll to Source", "Autoscroll to Source", AllIcons.General.AutoscrollToSource, this, "autoScrollToSource"));
    actionGroup.add(new PropertyToggleAction("Autoscroll from Source", "Autoscroll from Source111", AllIcons.General.AutoscrollFromSource, this, "autoScrollFromSource"));
    ActionToolbar toolBar = actionManager.createActionToolbar(ID_ACTION_TOOLBAR, actionGroup, true);
    JPanel panel = new JPanel(new HorizontalLayout(0));
    panel.add(toolBar.getComponent());
    myLanguagesComboBox = new ComboBox();
    panel.add(myLanguagesComboBox);
    updateLanguagesList(Collections.<Language>emptyList());
    _viewerPanel.add(panel, BorderLayout.NORTH);
    ToolWindow toolWindow = getToolWindow();
    toolWindow.setIcon(Helpers.getIcon(ICON_TOOL_WINDOW));
    _viewerPanel.setToolWindow(toolWindow);
    _editorListener = new EditorListener(_viewerPanel, _project);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ToolWindow(com.intellij.openapi.wm.ToolWindow) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) PsiViewerPanel(idea.plugin.psiviewer.view.PsiViewerPanel) ComboBox(com.intellij.openapi.ui.ComboBox) PropertyToggleAction(idea.plugin.psiviewer.controller.actions.PropertyToggleAction) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) HorizontalLayout(com.intellij.ui.components.panels.HorizontalLayout)

Example 43 with ActionManager

use of com.intellij.openapi.actionSystem.ActionManager in project intellij by bazelbuild.

the class BlazeActionRemover method replaceAction.

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

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