Class UiBufferChangeRunner

java.lang.Object
org.eclipse.handly.buffer.UiBufferChangeRunner

public final class UiBufferChangeRunner extends Object
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 Details

    • UiBufferChangeRunner

      public UiBufferChangeRunner(UiSynchronizer synchronizer, BufferChangeOperation operation)
      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 be null
      operation - a buffer change operation - must not be null
  • 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 (not null). The caller must not rely on IProgressMonitor.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 based
      org.eclipse.core.runtime.CoreException - if save is requested by the change but the buffer could not be saved
      org.eclipse.text.edits.MalformedTreeException - if the change's edit tree is not in a valid state
      org.eclipse.jface.text.BadLocationException - if one of the edits in the change's edit tree could not be executed