void (@NotNull ImmutableCharSequence newText, int offset, @NotNull CharSequence oldString, @NotNull CharSequence newString, boolean wholeTextReplaced, long newModificationStamp, int initialStartOffset, int initialOldLength, int moveOffset) { if (LOG.isTraceEnabled()) { LOG.trace("updating document " + this + ".\nNext string:'" + newString + "'\nOld string:'" + oldString + "'"); } assert moveOffset >= 0 && moveOffset <= getTextLength() : "Invalid moveOffset: " + moveOffset; assertNotNestedModification(); myChangeInProgress = true; DelayedExceptions exceptions = new DelayedExceptions(); try { DocumentEvent event = new DocumentEventImpl(this, offset, oldString, newString, myModificationStamp, wholeTextReplaced, initialStartOffset, initialOldLength, moveOffset); beforeChangedUpdate(event, exceptions); myTextString = null; ImmutableCharSequence prevText = myText; myText = newText; // increment sequence before firing events, so that the modification sequence on commit will match this sequence now sequence.incrementAndGet(); changedUpdate(event, newModificationStamp, prevText, exceptions); } finally { myChangeInProgress = false; exceptions.rethrowPCE(); } }