TextRange (GroovyPsiElement element) { assert element instanceof GrIfStatement; GrCondition condition = ((GrIfStatement)element).getCondition(); int endOffset = element.getTextRange().getEndOffset(); if (condition != null) { PsiElement child = condition.getFirstChild(); assert child != null; endOffset = child.getTextRange().getStartOffset(); condition.getParent().getNode().removeChild(condition.getNode()); } return new TextRange(endOffset, endOffset); }