// mouse events
 public void mouseClicked(final MouseEvent e) {
   CommandProcessor.getInstance()
       .executeCommand(
           myEditor.getProject(),
           new Runnable() {
             public void run() {
               doMouseClicked(e);
             }
           },
           EditorBundle.message("move.caret.command.name"),
           DocCommandGroupId.noneGroupId(getDocument()),
           UndoConfirmationPolicy.DEFAULT,
           getDocument());
 }
    @Override
    public void execute(
        @NotNull final Editor editor, char charTyped, @NotNull DataContext dataContext) {
      if (editor.isViewer()) return;

      Document doc = editor.getDocument();
      Project project = CommonDataKeys.PROJECT.getData(dataContext);
      if (!FileDocumentManager.getInstance().requestWriting(doc, project)) {
        return;
      }

      doc.startGuardedBlockChecking();
      try {
        final String str = String.valueOf(charTyped);
        CommandProcessor.getInstance()
            .setCurrentCommandName(EditorBundle.message("typing.in.editor.command.name"));
        EditorModificationUtil.typeInStringAtCaretHonorMultipleCarets(editor, str, true);
      } catch (ReadOnlyFragmentModificationException e) {
        EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e);
      } finally {
        doc.stopGuardedBlockChecking();
      }
    }