Example usage for com.intellij.openapi.editor.actionSystem TypedActionHandler execute

List of usage examples for com.intellij.openapi.editor.actionSystem TypedActionHandler execute

Introduction

In this page you can find the example usage for com.intellij.openapi.editor.actionSystem TypedActionHandler execute.

Prototype

void execute(@NotNull Editor editor, char charTyped, @NotNull DataContext dataContext);

Source Link

Document

Processes a key typed in the editor.

Usage

From source file:com.bmesta.powermode.PowerMode.java

License:Apache License

@Override
public void initComponent() {

    final EditorActionManager editorActionManager = EditorActionManager.getInstance();
    final EditorFactory editorFactory = EditorFactory.getInstance();
    particleContainerManager = new ParticleContainerManager();
    editorFactory.addEditorFactoryListener(particleContainerManager, new Disposable() {
        @Override/*from   ww  w  .  j  a  va  2 s  .  c  o  m*/
        public void dispose() {

        }
    });
    final TypedAction typedAction = editorActionManager.getTypedAction();
    final TypedActionHandler rawHandler = typedAction.getRawHandler();
    typedAction.setupRawHandler(new TypedActionHandler() {
        @Override
        public void execute(@NotNull final Editor editor, final char c,
                @NotNull final DataContext dataContext) {
            updateEditor(editor);
            rawHandler.execute(editor, c, dataContext);
        }
    });
}

From source file:org.jetbrains.plugins.ruby.ruby.actions.editor.typedAction.TypedActionTest.java

License:Apache License

protected void performAction() {
    final char charToPrint = myData.get(1).charAt(0);
    // RUBY-1697//  ww w .j  a  v a2  s  .co  m
    if (myData.size() == 3) {
        if ("overwrite".equals(myData.get(2).trim())) {
            ((EditorEx) myEditor).setInsertMode(false);
        }
    }
    final DataContext dataContext = new RubyDataContext();
    final TypedActionHandler handler = RubyEditorActionsManager
            .registerRubyTypedActionHandler(EditorActionManager.getInstance());

    performAction(new Runnable() {
        public void run() {
            handler.execute(myEditor, charToPrint, dataContext);
        }
    });
}