Package org.eclipse.handly.text
Class DocumentChangeOperation
java.lang.Object
org.eclipse.handly.text.DocumentChangeOperation
Applies a given change to a given
IDocument.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IDocumentChangeprotected final org.eclipse.jface.text.IDocument -
Constructor Summary
ConstructorsConstructorDescriptionDocumentChangeOperation(org.eclipse.jface.text.IDocument document, IDocumentChange change) Creates a new operation that can apply the given change to the given document. -
Method Summary
Modifier and TypeMethodDescriptionprotected IDocumentChangeprotected org.eclipse.text.edits.UndoEditprotected voidprotected org.eclipse.text.edits.TextEditProcessorprotected IDocumentChangecreateUndoChange(org.eclipse.text.edits.UndoEdit undoEdit, long stampToRestore) execute()Executes the document change.protected ISnapshotprotected static longgetModificationStampOf(org.eclipse.jface.text.IDocument document) protected static voidsetModificationStampOf(org.eclipse.jface.text.IDocument document, long modificationStamp)
-
Field Details
-
document
protected final org.eclipse.jface.text.IDocument document -
change
-
-
Constructor Details
-
DocumentChangeOperation
Creates a new operation that can apply the given change to the given document.- Parameters:
document- must not benullchange- must not benull
-
-
Method Details
-
execute
Executes the document change.Note that an update conflict may occur if the document's contents have changed since the inception of the snapshot on which the change is based. In that case, a
StaleSnapshotExceptionis thrown.- Returns:
- undo change, if requested by the change. Otherwise,
null - Throws:
StaleSnapshotException- if the document has changed since the inception of the snapshot on which the change is basedorg.eclipse.text.edits.MalformedTreeException- if the change's edit tree is not in a valid stateorg.eclipse.jface.text.BadLocationException- if one of the edits in the change's edit tree could not be executed
-
applyChange
- Throws:
org.eclipse.jface.text.BadLocationException
-
getCurrentSnapshot
-
checkChange
protected void checkChange() -
applyTextEdit
protected org.eclipse.text.edits.UndoEdit applyTextEdit() throws org.eclipse.jface.text.BadLocationException- Throws:
org.eclipse.jface.text.BadLocationException
-
createTextEditProcessor
protected org.eclipse.text.edits.TextEditProcessor createTextEditProcessor() -
createUndoChange
protected IDocumentChange createUndoChange(org.eclipse.text.edits.UndoEdit undoEdit, long stampToRestore) -
getModificationStampOf
protected static long getModificationStampOf(org.eclipse.jface.text.IDocument document) -
setModificationStampOf
protected static void setModificationStampOf(org.eclipse.jface.text.IDocument document, long modificationStamp)
-