private static int findOpeningBrace(GrTypeDefinitionBody block) {
    PsiElement lbrace = block.getLBrace();
    if (lbrace == null) return block.getTextRange().getStartOffset();

    while (PsiImplUtil.isWhiteSpace(lbrace.getNextSibling())) {
      lbrace = lbrace.getNextSibling();
    }
    return lbrace.getTextRange().getEndOffset();
  }
  private static int findClosingBrace(GrTypeDefinitionBody block, int startOffset) {
    PsiElement rbrace = block.getRBrace();
    if (rbrace == null) return block.getTextRange().getEndOffset();

    while (PsiImplUtil.isWhiteSpace(rbrace.getPrevSibling())
        && rbrace.getPrevSibling().getTextRange().getStartOffset() > startOffset) {
      rbrace = rbrace.getPrevSibling();
    }

    return rbrace.getTextRange().getStartOffset();
  }