Interface IAdvancedUndoableOperation2

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      IStatus computeExecutionStatus​(IProgressMonitor monitor)
      Return a status indicating the projected outcome of executing the receiver.
      boolean runInBackground()
      Return a boolean that instructs whether the operation should be executed, undone, or redone in a background thread.
      void setQuietCompute​(boolean quiet)
      Set a boolean that instructs whether the computation of the receiver's execution, undo, or redo status should quietly compute status without consulting or prompting the user.
    • Method Detail

      • computeExecutionStatus

        IStatus computeExecutionStatus​(IProgressMonitor monitor)
                                throws ExecutionException
        Return a status indicating the projected outcome of executing the receiver. This method should be used to report the possible outcome of executing an operation when computing the validity of an execute is too expensive to perform in IUndoableOperation.canExecute(). It is not called by the operation history, but instead is used by clients (such as implementers of IOperationApprover2) who wish to perform advanced validation of an operation before attempting to execute it. If the result of this method is the discovery that an operation can in fact not be executed, then the operation is expected to correctly answer false on subsequent calls to IUndoableOperation.canExecute().
        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 execute. The status severity should be set to OK if the execute can successfully be performed, and ERROR if it cannot. Any other severity is assumed to represent an ambiguous state.
        Throws:
        ExecutionException - if an exception occurs while computing the validity.
      • setQuietCompute

        void setQuietCompute​(boolean quiet)
        Set a boolean that instructs whether the computation of the receiver's execution, undo, or redo status should quietly compute status without consulting or prompting the user. The default value is false. This flag should only be set to true while the execution, undo, or redo status computations are being performed in the background, and should be restored to false when complete.

        If the status computation methods typically need to consult the user in order to determine the severity of a particular situation, the least severe status that could be chosen by the user should be returned when this flag is true. This can help to prevent overzealous disposal of the operation history when an operation is in an ambiguous state. Typically, the status computation methods are invoked with this flag set to false just before the actual execution, undo, or redo occurs, so the user can be consulted for the final outcome.

        Parameters:
        quiet - true if it is inappropriate to consult or otherwise prompt the user while computing status, and false if the user may be prompted.
        See Also:
        computeExecutionStatus(IProgressMonitor), IAdvancedUndoableOperation.computeUndoableStatus(IProgressMonitor), IAdvancedUndoableOperation.computeRedoableStatus(IProgressMonitor)
      • runInBackground

        boolean runInBackground()
        Return a boolean that instructs whether the operation should be executed, undone, or redone in a background thread.
        Returns:
        true if the operation should be run in the background, false if it should not.