boolean (int offset) { TextRange rootRange = myRootElement.getTextRange(); if (!rootRange.containsOffset(offset)) return false; if (offset > rootRange.getStartOffset() && offset < rootRange.getEndOffset()) return true; return myDocument.getTextLength() == rootRange.getLength(); }