@Override
  public Result preprocessEnter(@NotNull final PsiFile file,
                                @NotNull Editor editor,
                                @NotNull final Ref<Integer> caretOffsetRef,
                                final @NotNull Ref<Integer> caretAdvance,
                                @NotNull final DataContext dataContext,
                                final EditorActionHandler originalHandler) {
    if (!CodeInsightSettings.getInstance().SMART_INDENT_ON_ENTER) {
      return Result.Continue;
    }
    Document document = editor.getDocument();
    CharSequence text = document.getCharsSequence();
    int caretOffset = caretOffsetRef.get().intValue();

    final EnterBetweenBracesDelegate helper = getLanguageImplementation(EnterHandler.getLanguage(dataContext));
    if (!isApplicable(file, editor, text, caretOffset, helper)) {
      return Result.Continue;
    }

    final Data data = new Data(file, document, caretOffset);
    final String indentInsideJavadoc = data.getIndentInsideJavadoc(helper, editor);

    originalHandler.execute(editor, editor.getCaretModel().getCurrentCaret(), dataContext);

    Project project = editor.getProject();
    if (indentInsideJavadoc != null &&
        project != null &&
        data.isLeadingAsteriskEnabled()) {
      if (editor instanceof EditorWindow) {
        editor = ((EditorWindow)editor).getDelegate();
      }
      editor.getDocument().insertString(editor.getCaretModel().getOffset(), "*" + indentInsideJavadoc);
    }

    helper.formatAtOffset(file, editor, editor.getCaretModel().getOffset(), EnterHandler.getLanguage(dataContext));
    return indentInsideJavadoc == null ? Result.Continue : Result.DefaultForceIndent;
  }
@Override
  public Result preprocessEnter(@NotNull final PsiFile file,
                                @NotNull Editor editor,
                                @NotNull final Ref<Integer> caretOffsetRef,
                                final @NotNull Ref<Integer> caretAdvance,
                                @NotNull final DataContext dataContext,
                                final EditorActionHandler originalHandler)