@Override public void documentChanged(DocumentEvent event) { fPreservedRedoModificationStamp= event.getModificationStamp(); // record the current valid state for the top operation in case it remains the // top operation but changes state. IUndoableOperation op= fHistory.getUndoOperation(fUndoContext); boolean wasValid= false; if (op != null) wasValid= op.canUndo(); // Process the change, providing the before and after timestamps processChange(event.getOffset(), event.getOffset() + event.getLength(), event.getText(), fReplacedText, fPreservedUndoModificationStamp, fPreservedRedoModificationStamp); // now update fCurrent with the latest buffers from the document change. fCurrent.pretendCommit(); if (op == fCurrent) { // if the document change did not cause a new fCurrent to be created, then we should // notify the history that the current operation changed if its validity has changed. if (wasValid != fCurrent.isValid()) fHistory.operationChanged(op); } else { // if the change created a new fCurrent that we did not yet add to the // stack, do so if it's valid and we are not in the middle of a compound change. if (fCurrent != fLastAddedCommand && fCurrent.isValid()) { addToCommandStack(fCurrent); } } } }
history.operationChanged(operation);
@Override public void documentChanged(DocumentEvent event) { fPreservedRedoModificationStamp= event.getModificationStamp(); // record the current valid state for the top operation in case it remains the // top operation but changes state. IUndoableOperation op= fHistory.getUndoOperation(fUndoContext); boolean wasValid= false; if (op != null) wasValid= op.canUndo(); // Process the change, providing the before and after timestamps processChange(event.getOffset(), event.getOffset() + event.getLength(), event.getText(), fReplacedText, fPreservedUndoModificationStamp, fPreservedRedoModificationStamp); // now update fCurrent with the latest buffers from the document change. fCurrent.pretendCommit(); if (op == fCurrent) { // if the document change did not cause a new fCurrent to be created, then we should // notify the history that the current operation changed if its validity has changed. if (wasValid != fCurrent.isValid()) fHistory.operationChanged(op); } else { // if the change created a new fCurrent that we did not yet add to the // stack, do so if it's valid and we are not in the middle of a compound change. if (fCurrent != fLastAddedCommand && fCurrent.isValid()) { addToCommandStack(fCurrent); } } } }
fHistory.operationChanged(op); } else {
fHistory.operationChanged(op); } else {