Package org.eclipse.handly.buffer
Class BufferChangeOperation
java.lang.Object
org.eclipse.handly.buffer.BufferChangeOperation
Applies a given change to a given
IBuffer
.
This class is intended to be used in implementations of IBuffer
.
General clients should use IBuffer.applyChange(IBufferChange, IProgressMonitor)
instead.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
protected static class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBufferChangeOperation
(IBuffer buffer, IBufferChange change) Creates a new operation that can apply the given change to the given buffer. -
Method Summary
Modifier and TypeMethodDescriptionprotected IBufferChange
applyChange
(org.eclipse.core.runtime.IProgressMonitor monitor) protected org.eclipse.text.edits.UndoEdit
protected void
protected org.eclipse.text.edits.TextEditProcessor
protected IBufferChange
createUndoChange
(org.eclipse.text.edits.UndoEdit undoEdit, long stampToRestore) execute
(org.eclipse.core.runtime.IProgressMonitor monitor) Executes the buffer change.protected static long
getModificationStampOf
(org.eclipse.jface.text.IDocument document) protected static void
setModificationStampOf
(org.eclipse.jface.text.IDocument document, long modificationStamp)
-
Field Details
-
buffer
-
change
-
-
Constructor Details
-
BufferChangeOperation
Creates a new operation that can apply the given change to the given buffer.- Parameters:
buffer
- must not benull
change
- must not benull
-
-
Method Details
-
execute
public IBufferChange execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, org.eclipse.jface.text.BadLocationException Executes the buffer change.Note that an update conflict may occur if the buffer's contents have changed since the inception of the snapshot on which the change is based. In that case, a
StaleSnapshotException
is thrown.- Parameters:
monitor
- a progress monitor (notnull
). The caller must not rely onIProgressMonitor.done()
having been called by the receiver- Returns:
- undo change, if requested by the change. Otherwise,
null
- Throws:
StaleSnapshotException
- if the buffer has changed since the inception of the snapshot on which the change is basedorg.eclipse.core.runtime.CoreException
- if save is requested by the change but the buffer could not be savedorg.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 IBufferChange applyChange(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, org.eclipse.jface.text.BadLocationException - Throws:
org.eclipse.core.runtime.CoreException
org.eclipse.jface.text.BadLocationException
-
checkChange
protected void checkChange() throws org.eclipse.core.runtime.CoreException- Throws:
org.eclipse.core.runtime.CoreException
-
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 IBufferChange 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)
-