public void insertFragment(VEXDocumentFragment frag) throws DocumentValidationException { if (this.hasSelection()) { this.deleteSelection(); } this.document.insertFragment(this.getCaretOffset(), frag); this.moveTo(this.getCaretOffset() + frag.getLength()); }