@Override
  protected int calculateOffsetToInsertClosingBraceInsideElement(PsiElement element) {
    if (element instanceof PsiErrorElement &&
        ((PsiErrorElement)element).getErrorDescription().equals(JavaPsiBundle.message("else.without.if"))) {
      return element.getTextRange().getStartOffset();
    }
    ASTNode node = BasicJavaAstTreeUtil.toNode(element);
    if (BasicJavaAstTreeUtil.is(node, BASIC_EXPRESSION_LIST_STATEMENT)) {
      final ASTNode list = BasicJavaAstTreeUtil.getExpressionList(node);
      if (list != null) {
        final ASTNode firstExpression = BasicJavaAstTreeUtil.findChildByType(list, EXPRESSION_SET);
        if (firstExpression != null) {
          return firstExpression.getTextRange().getEndOffset();
        }
      }
    }
    return super.calculateOffsetToInsertClosingBraceInsideElement(element);
  }
@Override
  protected int calculateOffsetToInsertClosingBraceInsideElement(PsiElement element)