Class IXtextFile.ModifyingUnitOfWork

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.eclipse.xtext.util.concurrent.IUnitOfWork

        org.eclipse.xtext.util.concurrent.IUnitOfWork.Void<T extends Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      ModifyingUnitOfWork()
      Creates an undoable unit of work that will not be retried.
      ModifyingUnitOfWork​(int maxRetries)
      Creates an undoable unit of work that can be retried the given number of times.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptUndoChange​(org.eclipse.handly.buffer.IBufferChange undoChange)
      Notification of an undo change.
      org.eclipse.handly.buffer.IBufferChange getUndoChange()  
      org.eclipse.handly.buffer.IBufferChange newBufferChange​(org.eclipse.text.edits.TextEdit edit, org.eclipse.handly.snapshot.ISnapshot base)
      Returns a new buffer change according to the given specifications.
      boolean shouldRetry()
      Returns whether the transaction should be retried if it has failed due to a stale snapshot.
      • Methods inherited from class org.eclipse.xtext.util.concurrent.IUnitOfWork.Void

        exec, process
      • Methods inherited from interface org.eclipse.xtext.util.concurrent.IUnitOfWork

        exec
    • Constructor Detail

      • ModifyingUnitOfWork

        public ModifyingUnitOfWork()
        Creates an undoable unit of work that will not be retried.
      • ModifyingUnitOfWork

        public ModifyingUnitOfWork​(int maxRetries)
        Creates an undoable unit of work that can be retried the given number of times.
        Parameters:
        maxRetries -
    • Method Detail

      • newBufferChange

        public org.eclipse.handly.buffer.IBufferChange newBufferChange​(org.eclipse.text.edits.TextEdit edit,
                                                                       org.eclipse.handly.snapshot.ISnapshot base)
        Description copied from interface: IXtextFile.IModifyingUnitOfWork
        Returns a new buffer change according to the given specifications.
        Specified by:
        newBufferChange in interface IXtextFile.IModifyingUnitOfWork<Object>
        Parameters:
        edit - the text edit (not null)
        base - the snapshot on which the change is based (not null)
        Returns:
        the created buffer change (never null)
      • getUndoChange

        public final org.eclipse.handly.buffer.IBufferChange getUndoChange()
        Returns:
        the undo change, or null if the undo change has not been accepted yet or the change created by this unit of work was not undoable
      • shouldRetry

        public boolean shouldRetry()
        Description copied from interface: IXtextFile.IModifyingUnitOfWork
        Returns whether the transaction should be retried if it has failed due to a stale snapshot. Note that if true is always returned, it may lead to an infinite loop.
        Specified by:
        shouldRetry in interface IXtextFile.IModifyingUnitOfWork<Object>
        Returns:
        true if the transaction should be retried, false otherwise