@NotNull
 private static DataContext createEditorContext(@NotNull Editor editor) {
   Object e = editor;
   Object hostEditor =
       editor instanceof EditorWindow ? ((EditorWindow) editor).getDelegate() : editor;
   Map<String, Object> map =
       ContainerUtil.newHashMap(
           Pair.create(CommonDataKeys.HOST_EDITOR.getName(), hostEditor),
           Pair.createNonNull(CommonDataKeys.EDITOR.getName(), e));
   DataContext parent = DataManager.getInstance().getDataContext(editor.getContentComponent());
   return SimpleDataContext.getSimpleContext(map, parent);
 }
 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()));
   }
 }