Package org.eclipse.handly.text

# Class DocumentChangeOperation

java.lang.Object
org.eclipse.handly.text.DocumentChangeOperation

public class DocumentChangeOperation extends Object
Applies a given change to a given `IDocument`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `DocumentChangeOperation.UndoChange`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final IDocumentChange`
  `change`
  `protected final org.eclipse.jface.text.IDocument`
  `document`

- ## 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

  Modifier and Type
  Method
  Description
  `protected IDocumentChange`
  `applyChange()`
  `protected org.eclipse.text.edits.UndoEdit`
  `applyTextEdit()`
  `protected void`
  `checkChange()`
  `protected org.eclipse.text.edits.TextEditProcessor`
  `createTextEditProcessor()`
  `protected IDocumentChange`
  `createUndoChange(org.eclipse.text.edits.UndoEdit undoEdit, long stampToRestore)`
  `IDocumentChange`
  `execute()`
  Executes the document change.
  `protected ISnapshot`
  `getCurrentSnapshot()`
  `protected static long`
  `getModificationStampOf(org.eclipse.jface.text.IDocument document)`
  `protected static void`
  `setModificationStampOf(org.eclipse.jface.text.IDocument document, long modificationStamp)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### document

    protected final org.eclipse.jface.text.IDocument document

  - ### change

    protected final IDocumentChange change

- ## Constructor Details

  - ### 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 be `null`
      `change` - must not be `null`

- ## Method Details

  - ### 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 `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 based
      `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

  - ### 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)