Package org.eclipse.handly.text
Class DocumentChangeOperation
- java.lang.Object
-
- org.eclipse.handly.text.DocumentChangeOperation
-
public class DocumentChangeOperation extends java.lang.ObjectApplies a given change to a givenIDocument.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDocumentChangeOperation.UndoChange
-
Field Summary
Fields Modifier and Type Field Description protected IDocumentChangechangeprotected org.eclipse.jface.text.IDocumentdocument
-
Constructor Summary
Constructors Constructor Description DocumentChangeOperation(org.eclipse.jface.text.IDocument document, IDocumentChange change)Creates a new operation that can apply the given change to the given document.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IDocumentChangeapplyChange()protected org.eclipse.text.edits.UndoEditapplyTextEdit()protected voidcheckChange()protected org.eclipse.text.edits.TextEditProcessorcreateTextEditProcessor()protected IDocumentChangecreateUndoChange(org.eclipse.text.edits.UndoEdit undoEdit, long stampToRestore)IDocumentChangeexecute()Executes the document change.protected ISnapshotgetCurrentSnapshot()protected static longgetModificationStampOf(org.eclipse.jface.text.IDocument document)protected static voidsetModificationStampOf(org.eclipse.jface.text.IDocument document, long modificationStamp)
-
-
-
Field Detail
-
document
protected final org.eclipse.jface.text.IDocument document
-
change
protected final IDocumentChange change
-
-
Constructor Detail
-
DocumentChangeOperation
public DocumentChangeOperation(org.eclipse.jface.text.IDocument document, IDocumentChange change)Creates a new operation that can apply the given change to the given document.- Parameters:
document- must not benullchange- must not benull
-
-
Method Detail
-
execute
public IDocumentChange execute() throws org.eclipse.jface.text.BadLocationException
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
protected IDocumentChange applyChange() throws org.eclipse.jface.text.BadLocationException
- Throws:
org.eclipse.jface.text.BadLocationException
-
getCurrentSnapshot
protected ISnapshot 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)
-
-