Class OperationHistoryEvent

java.lang.Object
org.eclipse.core.commands.operations.OperationHistoryEvent

public final class OperationHistoryEvent extends Object

OperationHistoryEvent is used to communicate changes that occur in a DefaultOperationHistory, including the addition or removal of operations, and the execution, undo, and redo of operations.

Operation history listeners must be prepared to receive notifications from a background thread. Any UI access occurring inside the implementation must be properly synchronized using the techniques specified by the client's widget library.

Since:
3.1
  • Field Details

    • ABOUT_TO_EXECUTE

      public static final int ABOUT_TO_EXECUTE
      ABOUT_TO_EXECUTE indicates that an operation is about to execute. Listeners should prepare for the execution as appropriate. Listeners will receive a DONE notification if the operation is successful, or an OPERATION_NOT_OK notification if the execution is cancelled or otherwise fails. This notification is only received for those operations executed by the operation history. Operations that are added to the history after execution do not trigger these notifications. If the operation successfully executes, clients will also receive a notification that it has been added to the history. (value is 1).
      See Also:
    • ABOUT_TO_REDO

      public static final int ABOUT_TO_REDO
      ABOUT_TO_REDO indicates that an operation is about to be redone. Listeners should prepare for the redo as appropriate. Listeners will receive a REDONE notification if the operation is successful, or an OPERATION_NOT_OK notification if the redo is cancelled or otherwise fails. (value is 2).
      See Also:
    • ABOUT_TO_UNDO

      public static final int ABOUT_TO_UNDO
      ABOUT_TO_UNDO indicates that an operation is about to be undone. Listeners should prepare for the undo as appropriate. Listeners will receive an UNDONE notification if the operation is successful, or an OPERATION_NOT_OK notification if the undo is cancelled or otherwise fails. (value is 3).
      See Also:
    • DONE

      public static final int DONE
      DONE indicates that an operation has been executed. Listeners can take appropriate action, such as revealing any relevant state in the UI. This notification is only received for those operations executed by the operation history. Operations that are added to the history after execution do not trigger this notification. Clients will also receive a notification that the operation has been added to the history. (value is 4).
      See Also:
    • OPERATION_ADDED

      public static final int OPERATION_ADDED
      OPERATION_ADDED indicates that an operation was added to the history. Listeners can use this notification to add their undo context to a new operation as appropriate or otherwise record the operation. (value is 5).
      See Also:
    • OPERATION_CHANGED

      public static final int OPERATION_CHANGED
      OPERATION_CHANGED indicates that an operation has changed in some way since it was added to the operations history. (value is 6).
      See Also:
    • OPERATION_NOT_OK

      public static final int OPERATION_NOT_OK
      OPERATION_NOT_OK indicates that an operation was attempted and not successful. Listeners typically use this when they have prepared for an execute, undo, or redo, and need to know that the operation did not successfully complete. For example, listeners that turn redraw off before an operation is undone would turn redraw on when the operation completes, or when this notification is received, since there will be no notification of the completion. (value is 7).
      See Also:
    • OPERATION_REMOVED

      public static final int OPERATION_REMOVED
      OPERATION_REMOVED indicates an operation was removed from the history. Listeners typically remove any record of the operation that they may have kept in their own state. The operation has been disposed by the time listeners receive this notification. (value is 8).
      See Also:
    • REDONE

      public static final int REDONE
      REDONE indicates that an operation was redone. Listeners can take appropriate action, such as revealing any relevant state in the UI. (value is 9).
      See Also:
    • UNDONE

      public static final int UNDONE
      UNDONE indicates that an operation was undone. Listeners can take appropriate action, such as revealing any relevant state in the UI. (value is 10).
      See Also:
  • Constructor Details

    • OperationHistoryEvent

      public OperationHistoryEvent(int code, IOperationHistory history, IUndoableOperation operation)
      Construct an event for the specified operation history.
      Parameters:
      code - the event code to be used.
      history - the history triggering the event.
      operation - the operation involved in the event.
    • OperationHistoryEvent

      public OperationHistoryEvent(int code, IOperationHistory history, IUndoableOperation operation, IStatus status)
      Construct an event for the specified operation history.
      Parameters:
      code - the event code to be used.
      history - the history triggering the event.
      operation - the operation involved in the event.
      status - the status associated with the event, or null if no status is available.
      Since:
      3.2
  • Method Details

    • getEventType

      public int getEventType()
      Return the type of event that is occurring.
      Returns:
      the type code indicating the type of event.
    • getHistory

      public IOperationHistory getHistory()
      Return the operation history that triggered this event.
      Returns:
      the operation history
    • getOperation

      public IUndoableOperation getOperation()
      Return the operation associated with this event.
      Returns:
      the operation
    • getStatus

      public IStatus getStatus()
      Return the status associated with this event.
      Returns:
      the status associated with this event. The status may be null.
      Since:
      3.2