Eclipse Platform
Release 3.1

org.eclipse.core.commands.operations
Class OperationHistoryEvent

java.lang.Object
  extended byorg.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 Summary
static int ABOUT_TO_EXECUTE
          ABOUT_TO_EXECUTE indicates that an operation is about to execute.
static int ABOUT_TO_REDO
          ABOUT_TO_REDO indicates that an operation is about to be redone.
static int ABOUT_TO_UNDO
          ABOUT_TO_UNDO indicates that an operation is about to be undone.
static int DONE
          DONE indicates that an operation has been executed.
static int OPERATION_ADDED
          OPERATION_ADDED indicates that an operation was added to the history.
static int OPERATION_CHANGED
          OPERATION_CHANGED indicates that an operation has changed in some way since it was added to the operations history.
static int OPERATION_NOT_OK
          OPERATION_NOT_OK indicates that an operation was attempted and not successful.
static int OPERATION_REMOVED
          OPERATION_REMOVED indicates an operation was removed from the history.
static int REDONE
          REDONE indicates that an operation was redone.
static int UNDONE
          UNDONE indicates that an operation was undone.
 
Constructor Summary
OperationHistoryEvent(int code, IOperationHistory history, IUndoableOperation operation)
          Construct an event for the specified operation history.
 
Method Summary
 int getEventType()
          Return the type of event that is occurring.
 IOperationHistory getHistory()
          Return the operation history that triggered this event.
 IUndoableOperation getOperation()
          Return the operation associated with this event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values
Constructor Detail

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.
Method Detail

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

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.