@Override
  public Result preprocessEnter(@NotNull final PsiFile file,
                                @NotNull final Editor editor,
                                @NotNull final Ref<Integer> caretOffsetRef,
                                final @NotNull Ref<Integer> caretAdvance,
                                @NotNull final DataContext dataContext,
                                final EditorActionHandler originalHandler) {

    int caretOffset = caretOffsetRef.get();
    if (!isApplicable(file, caretOffset)) {
      return Result.Continue;
    }

    int maxRBraceCount = getMaxRBraceCount(file, editor, caretOffset);
    if (maxRBraceCount > 0) {
      insertRBraces(file, editor,
                    caretOffset,
                    getRBraceOffset(file, editor, caretOffset),
                    generateStringToInsert(editor, caretOffset, maxRBraceCount));
      return Result.DefaultForceIndent;
    }
    return Result.Continue;
  }
@Override
  public Result preprocessEnter(@NotNull final PsiFile file,
                                @NotNull final Editor editor,
                                @NotNull final Ref<Integer> caretOffsetRef,
                                final @NotNull Ref<Integer> caretAdvance,
                                @NotNull final DataContext dataContext,
                                final EditorActionHandler originalHandler)