Interface IAdvancedUndoableOperation

    • Method Detail

      • aboutToNotify

        void aboutToNotify​(OperationHistoryEvent event)

        An operation history notification about this operation is about to be sent to operation history listeners. Any preparation needed before listeners are notified about this operation should be performed here.

        This method has been added to support legacy undo frameworks that are adapting to IUndoableOperation. Operations that previously relied on notification from their containing history or stack before any listeners are notified about changes to the operation should implement this interface.

        Parameters:
        event - the event that is about to be sent with the pending notification
      • getAffectedObjects

        Object[] getAffectedObjects()

        Return an array of objects that are affected by executing, undoing, or redoing this operation. If it cannot be determined which objects are affected, return null.

        Returns:
        the array of Objects modified by this operation, or null if the affected objects cannot be determined.
      • computeUndoableStatus

        IStatus computeUndoableStatus​(IProgressMonitor monitor)
                               throws ExecutionException
        Return a status indicating the projected outcome of undoing the receiver. This method should be used to report the possible outcome of an undo and is used when computing the validity of an undo is too expensive to perform in IUndoableOperation.canUndo(). It is not called by the operation history, but instead is used by clients (such as implementers of IOperationApprover) who wish to perform advanced validation of an operation before attempting to undo it. If the result of this method is the discovery that an operation can in fact not be undone, then the operation is expected to correctly answer false on subsequent calls to IUndoableOperation.canUndo().
        Parameters:
        monitor - the progress monitor (or null) to use for reporting progress to the user while computing the validity.
        Returns:
        the IStatus indicating the validity of the undo. The status severity should be set to OK if the undo can successfully be performed, and ERROR if it cannnot. Any other status is assumed to represent an ambiguous state.
        Throws:
        ExecutionException - if an exception occurs while computing the validity.
      • computeRedoableStatus

        IStatus computeRedoableStatus​(IProgressMonitor monitor)
                               throws ExecutionException
        Return a status indicating the projected outcome of redoing the receiver. This method should be used to report the possible outcome of a redo and is used when computing the validity of a redo is too expensive to perform in IUndoableOperation.canRedo(). It is not called by the operation history, but instead is used by clients (such as implementers of IOperationApprover) who wish to perform advanced validation of an operation before attempting to redo it. If the result of this method is the discovery that an operation can in fact not be redone, then the operation is expected to correctly answer false on subsequent calls to IUndoableOperation.canRedo().
        Parameters:
        monitor - the progress monitor (or null) to use for reporting progress to the user while computing the validity.
        Returns:
        the IStatus indicating the validity of the redo. The status severity should be set to OK if the redo can successfully be performed, and ERROR if it cannnot. Any other status is assumed to represent an ambiguous state.
        Throws:
        ExecutionException - if an exception occurs while computing the validity.