@Override
  protected TextRange getSurroundSelectionRange(GroovyPsiElement element) {
    assert element instanceof GrTryCatchStatement;
    int endOffset = element.getTextRange().getEndOffset();
    GrTryCatchStatement tryCatchStatement = (GrTryCatchStatement) element;

    GrCatchClause[] catchClauses = tryCatchStatement.getCatchClauses();
    if (catchClauses.length > 0) {
      GrParameter parameter = catchClauses[0].getParameter();
      if (parameter == null) {
        GrOpenBlock block = catchClauses[0].getBody();
        assert block != null;
        endOffset = block.getTextRange().getEndOffset();
      } else {
        endOffset = parameter.getTextRange().getStartOffset();
        parameter.getParent().getNode().removeChild(parameter.getNode());
      }
    } else {
      GrOpenBlock block = tryCatchStatement.getTryBlock();
      if (block != null) {
        GrStatement[] statements = block.getStatements();
        if (statements.length > 0) {
          endOffset = statements[0].getTextRange().getStartOffset();
        }
      }
    }

    return new TextRange(endOffset, endOffset);
  }
@Override
  protected TextRange getSurroundSelectionRange(GroovyPsiElement element)