public void playBack(DataContext context) { Editor editor = CommonDataKeys.EDITOR.getData(context); final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction(); for (final char aChar : myText.toCharArray()) { typedAction.actionPerformed(editor, aChar, context); } }
public void playBack(DataContext context) { Editor editor = PlatformDataKeys.EDITOR.getData(context); final TypedAction typedAction = EditorActionManager.getInstance().getTypedAction(); char chars[] = myText.toCharArray(); for (int i = 0; i < chars.length; i++) { typedAction.actionPerformed(editor, chars[i], context); } }
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); } }
public static void performTypingAction(Editor editor, char c) { EditorActionManager actionManager = EditorActionManager.getInstance(); if (c == BACKSPACE_FAKE_CHAR) { executeAction(editor, IdeActions.ACTION_EDITOR_BACKSPACE); } else if (c == SMART_ENTER_FAKE_CHAR) { executeAction(editor, IdeActions.ACTION_EDITOR_COMPLETE_STATEMENT); } else if (c == SMART_LINE_SPLIT_CHAR) { executeAction(editor, IdeActions.ACTION_EDITOR_SPLIT); } else if (c == '\n') { executeAction(editor, IdeActions.ACTION_EDITOR_ENTER); } else { TypedAction action = actionManager.getTypedAction(); action.actionPerformed( editor, c, DataManager.getInstance().getDataContext(editor.getContentComponent())); } }