Class DocumentChangeOperation

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

public class DocumentChangeOperation extends Object
Applies a given change to a given IDocument.
  • 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)