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
-
Field Summary
Modifier and TypeFieldDescriptionprotected final IDocumentChange
protected final org.eclipse.jface.text.IDocument
-
Constructor Summary
ConstructorDescriptionDocumentChangeOperation
(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 IDocumentChange
protected org.eclipse.text.edits.UndoEdit
protected void
protected org.eclipse.text.edits.TextEditProcessor
protected IDocumentChange
createUndoChange
(org.eclipse.text.edits.UndoEdit undoEdit, long stampToRestore) execute()
Executes the document change.protected ISnapshot
protected static long
getModificationStampOf
(org.eclipse.jface.text.IDocument document) protected static void
setModificationStampOf
(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 benull
change
- 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
StaleSnapshotException
is 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)
-