Package org.eclipse.handly.buffer
Class UiBufferChangeRunner
java.lang.Object
org.eclipse.handly.buffer.UiBufferChangeRunner
Executes a
BufferChangeOperation
in the UI thread.
This class is intended to be used in buffer implementations.
General clients should use IBuffer.applyChange(IBufferChange, IProgressMonitor)
instead.-
Constructor Summary
ConstructorDescriptionUiBufferChangeRunner
(UiSynchronizer synchronizer, BufferChangeOperation operation) Creates a new runner capable of executing the given buffer change operation in the UI thread. -
Method Summary
Modifier and TypeMethodDescriptionrun
(org.eclipse.core.runtime.IProgressMonitor monitor) Synchronously executes the buffer change operation in the UI thread.
-
Constructor Details
-
UiBufferChangeRunner
Creates a new runner capable of executing the given buffer change operation in the UI thread.- Parameters:
synchronizer
- used to execute operation in the UI thread - must not benull
operation
- a buffer change operation - must not benull
-
-
Method Details
-
run
public IBufferChange run(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, org.eclipse.jface.text.BadLocationException Synchronously executes the buffer change operation in the UI thread. Temporarily transfers the current thread's scheduling rule to the UI thread.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
-