Search in sources :

Example 6 with TypedAction

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

the class LightPlatformCodeInsightTestCase method type.

public static void type(char c, @NotNull Editor editor, Project project) {
    if (c == '\n') {
        executeAction(IdeActions.ACTION_EDITOR_ENTER, editor, project);
    } else {
        EditorActionManager actionManager = EditorActionManager.getInstance();
        final DataContext dataContext = DataManager.getInstance().getDataContext();
        TypedAction action = actionManager.getTypedAction();
        action.actionPerformed(editor, c, dataContext);
    }
}
Also used : EditorActionManager(com.intellij.openapi.editor.actionSystem.EditorActionManager) DataContext(com.intellij.openapi.actionSystem.DataContext) TypedAction(com.intellij.openapi.editor.actionSystem.TypedAction)

Example 7 with TypedAction

use of com.intellij.openapi.editor.actionSystem.TypedAction in project ideavim by JetBrains.

the class VimPlugin method initComponent.

@Override
public void initComponent() {
    LOG.debug("initComponent");
    Notifications.Bus.register(IDEAVIM_STICKY_NOTIFICATION_ID, NotificationDisplayType.STICKY_BALLOON);
    ApplicationManager.getApplication().invokeLater(new Runnable() {

        public void run() {
            updateState();
        }
    });
    final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
    EventFacade.getInstance().setupTypedActionHandler(new VimTypedActionHandler(typedAction.getRawHandler()));
    // Register vim actions in command mode
    RegisterActions.registerActions();
    // Add some listeners so we can handle special events
    setupListeners();
    // Register ex handlers
    CommandParser.getInstance().registerHandlers();
    if (!ApplicationManager.getApplication().isUnitTestMode()) {
        final File ideaVimRc = VimScriptParser.findIdeaVimRc();
        if (ideaVimRc != null) {
            VimScriptParser.executeFile(ideaVimRc);
        }
    }
    LOG.debug("done");
}
Also used : TypedAction(com.intellij.openapi.editor.actionSystem.TypedAction) File(java.io.File)

Example 8 with TypedAction

use of com.intellij.openapi.editor.actionSystem.TypedAction in project ideavim by JetBrains.

the class EventFacade method setupTypedActionHandler.

public void setupTypedActionHandler(@NotNull TypedActionHandler handler) {
    final TypedAction typedAction = getTypedAction();
    myOriginalTypedActionHandler = typedAction.getRawHandler();
    typedAction.setupRawHandler(handler);
}
Also used : TypedAction(com.intellij.openapi.editor.actionSystem.TypedAction)

Example 9 with TypedAction

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

the class SelectionQuotingTypedHandlerTest method testRuby7852ErrantEditor.

public void testRuby7852ErrantEditor() {
    myFixture.configureByText(FileTypes.PLAIN_TEXT, "\"aaa\"\nbbb\n\n");
    myFixture.getEditor().getCaretModel().moveToOffset(0);
    myFixture.getEditor().getSelectionModel().setSelection(0, 5);
    final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction();
    performAction(myFixture.getProject(), () -> typedAction.actionPerformed(myFixture.getEditor(), '\'', ((EditorEx) myFixture.getEditor()).getDataContext()));
    myFixture.getEditor().getSelectionModel().removeSelection();
    myFixture.checkResult("'aaa'\nbbb\n\n");
    myFixture.getEditor().getCaretModel().moveToOffset(myFixture.getEditor().getDocument().getLineStartOffset(3));
    performAction(myFixture.getProject(), () -> {
        typedAction.actionPerformed(myFixture.getEditor(), 'A', ((EditorEx) myFixture.getEditor()).getDataContext());
        typedAction.actionPerformed(myFixture.getEditor(), 'B', ((EditorEx) myFixture.getEditor()).getDataContext());
    });
    myFixture.checkResult("'aaa'\nbbb\n\nAB");
}
Also used : EditorEx(com.intellij.openapi.editor.ex.EditorEx) TypedAction(com.intellij.openapi.editor.actionSystem.TypedAction)

Example 10 with TypedAction

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

the class ConsoleViewImplTest method typeIn.

private static void typeIn(Editor editor, char c) {
    TypedAction action = EditorActionManager.getInstance().getTypedAction();
    DataContext dataContext = ((EditorEx) editor).getDataContext();
    action.actionPerformed(editor, c, dataContext);
}
Also used : EditorEx(com.intellij.openapi.editor.ex.EditorEx) TypedAction(com.intellij.openapi.editor.actionSystem.TypedAction)

Aggregations

TypedAction (com.intellij.openapi.editor.actionSystem.TypedAction)12 EditorEx (com.intellij.openapi.editor.ex.EditorEx)5 EditorActionManager (com.intellij.openapi.editor.actionSystem.EditorActionManager)4 DataContext (com.intellij.openapi.actionSystem.DataContext)2 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)1 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 HintHint (com.intellij.ui.HintHint)1 LightweightHint (com.intellij.ui.LightweightHint)1 File (java.io.File)1