TextDocument GetDocument() { TextDocument document = this.Document; if (document == null) throw ThrowUtil.NoDocumentAssigned(); return document; }