Search in sources :

Example 11 with ActionManagerEx

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

the class XXXXX method processKeyTyped.

private boolean processKeyTyped(char c) {
    // [vova] This is patch for Mac OS X. Under Mac "input methods"
    // is handled before our EventQueue consume upcoming KeyEvents.
    IdeEventQueue queue = IdeEventQueue.getInstance();
    if (queue.shouldNotTypeInEditor() || ProgressManager.getInstance().hasModalProgressIndicator()) {
        return false;
    }
    FileDocumentManager manager = FileDocumentManager.getInstance();
    final VirtualFile file = manager.getFile(myDocument);
    if (file != null && !file.isValid()) {
        return false;
    }
    ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
    DataContext dataContext = getDataContext();
    actionManager.fireBeforeEditorTyping(c, dataContext);
    MacUIUtil.hideCursor();
    EditorActionManager.getInstance().getTypedAction().actionPerformed(this, c, dataContext);
    return true;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DataContext(com.intellij.openapi.actionSystem.DataContext) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) ActionManagerEx(com.intellij.openapi.actionSystem.ex.ActionManagerEx)

Example 12 with ActionManagerEx

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

the class CloudDebugHistoricalSnapshotsTest method setUp.

@Before
public void setUp() {
    MockApplication application = new MyMockApplicationEx(parent);
    ActionManagerEx manager = Mockito.mock(ActionManagerEx.class);
    ActionToolbar actionToolbar = Mockito.mock(ActionToolbar.class);
    Mockito.when(actionToolbar.getComponent()).thenReturn(new JComponent() {
    });
    Mockito.when(manager.createActionToolbar(Mockito.anyString(), Mockito.any(ActionGroup.class), Mockito.anyBoolean())).thenReturn(actionToolbar);
    Mockito.when(manager.createActionToolbar(Mockito.anyString(), Mockito.any(ActionGroup.class), Mockito.anyBoolean(), Mockito.anyBoolean())).thenReturn(actionToolbar);
    application.addComponent(ActionManager.class, manager);
    application.registerService(UISettings.class);
    ApplicationManager.setApplication(application, parent);
    XDebugSession session = Mockito.mock(XDebugSession.class);
    Mockito.when(handler.getProcess()).thenReturn(mockProcess);
    Mockito.when(mockProcess.getXDebugSession()).thenReturn(session);
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) MockApplication(com.intellij.mock.MockApplication) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) JComponent(javax.swing.JComponent) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) ActionManagerEx(com.intellij.openapi.actionSystem.ex.ActionManagerEx) Before(org.junit.Before)

Example 13 with ActionManagerEx

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

the class BaseToolKeymapExtension method createGroup.

@Override
public KeymapGroup createGroup(final Condition<AnAction> filtered, final Project project) {
    final ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
    String[] ids = actionManager.getActionIds(getActionIdPrefix());
    Arrays.sort(ids);
    Group group = new Group(getGroupName(), AllIcons.Nodes.KeymapTools);
    HashMap<String, Group> toolGroupNameToGroup = new HashMap<>();
    for (String id : ids) {
        if (filtered != null && !filtered.value(actionManager.getActionOrStub(id)))
            continue;
        String groupName = getGroupByActionId(id);
        if (groupName != null && groupName.trim().length() == 0) {
            groupName = null;
        }
        Group subGroup = toolGroupNameToGroup.get(groupName);
        if (subGroup == null) {
            subGroup = new Group(groupName, null, null);
            toolGroupNameToGroup.put(groupName, subGroup);
            if (groupName != null) {
                group.addGroup(subGroup);
            }
        }
        subGroup.addActionId(id);
    }
    Group subGroup = toolGroupNameToGroup.get(null);
    if (subGroup != null) {
        group.addAll(subGroup);
    }
    return group;
}
Also used : KeymapGroup(com.intellij.openapi.keymap.KeymapGroup) Group(com.intellij.openapi.keymap.impl.ui.Group) HashMap(com.intellij.util.containers.HashMap) ActionManagerEx(com.intellij.openapi.actionSystem.ex.ActionManagerEx)

Example 14 with ActionManagerEx

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

the class ActionsTreeUtil method createMacrosGroup.

private static Group createMacrosGroup(Condition<AnAction> filtered) {
    final ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
    String[] ids = actionManager.getActionIds(ActionMacro.MACRO_ACTION_PREFIX);
    Arrays.sort(ids);
    Group group = new Group(KeyMapBundle.message("macros.group.title"), null, null);
    for (String id : ids) {
        if (filtered == null || filtered.value(actionManager.getActionOrStub(id))) {
            group.addActionId(id);
        }
    }
    return group;
}
Also used : KeymapGroup(com.intellij.openapi.keymap.KeymapGroup) ActionManagerEx(com.intellij.openapi.actionSystem.ex.ActionManagerEx)

Example 15 with ActionManagerEx

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

the class ActionsTreeUtil method createPluginsActionsGroup.

private static Group createPluginsActionsGroup(Condition<AnAction> filtered) {
    Group pluginsGroup = new Group(KeyMapBundle.message("plugins.group.title"), null, null);
    final KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
    ActionManagerEx managerEx = ActionManagerEx.getInstanceEx();
    final List<IdeaPluginDescriptor> plugins = new ArrayList<>();
    Collections.addAll(plugins, PluginManagerCore.getPlugins());
    Collections.sort(plugins, Comparator.comparing(IdeaPluginDescriptor::getName));
    List<PluginId> collected = new ArrayList<>();
    for (IdeaPluginDescriptor plugin : plugins) {
        collected.add(plugin.getPluginId());
        Group pluginGroup;
        if (plugin.getName().equals("IDEA CORE")) {
            continue;
        } else {
            pluginGroup = new Group(plugin.getName(), null, null);
        }
        final String[] pluginActions = managerEx.getPluginActions(plugin.getPluginId());
        if (pluginActions.length == 0) {
            continue;
        }
        Arrays.sort(pluginActions, Comparator.comparing(ActionsTreeUtil::getTextToCompare));
        for (String pluginAction : pluginActions) {
            if (keymapManager.getBoundActions().contains(pluginAction))
                continue;
            final AnAction anAction = managerEx.getActionOrStub(pluginAction);
            if (filtered == null || filtered.value(anAction)) {
                pluginGroup.addActionId(pluginAction);
            }
        }
        if (pluginGroup.getSize() > 0) {
            pluginsGroup.addGroup(pluginGroup);
        }
    }
    for (PluginId pluginId : PluginId.getRegisteredIds().values()) {
        if (collected.contains(pluginId))
            continue;
        Group pluginGroup = new Group(pluginId.getIdString(), null, null);
        final String[] pluginActions = managerEx.getPluginActions(pluginId);
        if (pluginActions.length == 0) {
            continue;
        }
        for (String pluginAction : pluginActions) {
            if (keymapManager.getBoundActions().contains(pluginAction))
                continue;
            final AnAction anAction = managerEx.getActionOrStub(pluginAction);
            if (filtered == null || filtered.value(anAction)) {
                pluginGroup.addActionId(pluginAction);
            }
        }
        if (pluginGroup.getSize() > 0) {
            pluginsGroup.addGroup(pluginGroup);
        }
    }
    return pluginsGroup;
}
Also used : KeymapGroup(com.intellij.openapi.keymap.KeymapGroup) KeymapManagerEx(com.intellij.openapi.keymap.ex.KeymapManagerEx) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId) ActionManagerEx(com.intellij.openapi.actionSystem.ex.ActionManagerEx)

Aggregations

ActionManagerEx (com.intellij.openapi.actionSystem.ex.ActionManagerEx)20 KeymapGroup (com.intellij.openapi.keymap.KeymapGroup)5 DataContext (com.intellij.openapi.actionSystem.DataContext)3 AnAction (com.intellij.openapi.actionSystem.AnAction)2 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)2 KeymapManagerEx (com.intellij.openapi.keymap.ex.KeymapManagerEx)2 Project (com.intellij.openapi.project.Project)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 HashMap (com.intellij.util.containers.HashMap)2 NotNull (org.jetbrains.annotations.NotNull)2 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 AntBuildFile (com.intellij.lang.ant.config.AntBuildFile)1 AntConfiguration (com.intellij.lang.ant.config.AntConfiguration)1 TargetAction (com.intellij.lang.ant.config.actions.TargetAction)1 MockApplication (com.intellij.mock.MockApplication)1 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)1 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)1 PluginId (com.intellij.openapi.extensions.PluginId)1 Group (com.intellij.openapi.keymap.impl.ui.Group)1 MouseShortcutPanel (com.intellij.openapi.keymap.impl.ui.MouseShortcutPanel)1