TextRange () { TreeElement nameChild = (TreeElement)findChildByRole(ChildRole.REFERENCE_NAME); if (nameChild == null) return new TextRange(0, getTextLength()); int startOffset = nameChild.getStartOffsetInParent(); return new TextRange(startOffset, startOffset + nameChild.getTextLength()); }