|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ui.operations.NonLocalUndoUserApprover
An operation approver that prompts the user to see if a non-local undo should
proceed inside an editor. A non-local undo is detected when an operation
being undone or redone affects elements other than those described by the
editor itself. Clients can optionally specify a class, the preferred
comparison class, that should be used when comparing objects affected by the
editor with objects affected by an undo or redo operation. Comparisons
between the affected objects inside the editor and those described by the
operation will first be done by simply performing an equality check, using
Object.equals(java.lang.Object)
. If an object described by
an operation is not equal to one of the objects affected by the editor, and
if it is not an instance of the preferred comparison class, but is an
instance of IAdaptable
, then the operation
approver will also attempt to retrieve an adapter on that object for the
preferred comparison class and perform a second equality check using the
adapter.
This class may be instantiated by clients.
Constructor Summary | |
---|---|
NonLocalUndoUserApprover(IUndoContext context,
IEditorPart part,
Object[] affectedObjects,
Class preferredComparisonClass)
Create a NonLocalUndoUserApprover associated with the specified editor and undo context |
Method Summary | |
---|---|
IStatus |
proceedRedoing(IUndoableOperation operation,
IOperationHistory history,
IAdaptable uiInfo)
Return a status indicating whether the specified operation should be redone. |
IStatus |
proceedUndoing(IUndoableOperation operation,
IOperationHistory history,
IAdaptable uiInfo)
Return a status indicating whether the specified operation should be undone. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NonLocalUndoUserApprover(IUndoContext context, IEditorPart part, Object[] affectedObjects, Class preferredComparisonClass)
context
- the undo context of operations in question.part
- the editor part that is displaying the elementaffectedObjects
- the objects that are affected by the editor and considered to
be objects local to the editor. The objects are typically
instances of the preferredComparisonClass or else provide
adapters for the preferredComparisonClass, although this is
not required.preferredComparisonClass
- the preferred class to be used when comparing the editor's
affectedObjects with those provided by the undoable operation
using
IAdvancedUndoableOperation.getAffectedObjects()
.
If the operation's affected objects are not instances of the
specified class, but are instances of
IAdaptable
, then an adapter
for this class will be requested. The preferredComparisonClass
may be null
, which indicates that there is no
expected class or adapter necessary for the comparison.Method Detail |
public IStatus proceedRedoing(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo)
IOperationApprover
IStatus.OK
will not be approved. Implementers should not assume that the redo will
be performed when the status is OK
, since other operation
approvers may veto the redo.
proceedRedoing
in interface IOperationApprover
operation
- the operation to be redonehistory
- the history redoing the operationuiInfo
- the IAdaptable (or null
) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null
, it should minimally contain an adapter
for the org.eclipse.swt.widgets.Shell.class. Even if UI
information is provided, the implementation of this method
must be prepared for being called from a background thread.
Any UI access must be properly synchronized using the
techniques specified by the client's widget library.
OK
, and the caller requesting the redo will be
returned the status that caused the rejection. Any other status
severities will not be interpreted by the history.public IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable uiInfo)
IOperationApprover
IStatus.OK
will not be approved. Implementers should not assume that the undo will
be performed when the status is OK
, since other operation
approvers can veto the undo.
proceedUndoing
in interface IOperationApprover
operation
- the operation to be undonehistory
- the history undoing the operationuiInfo
- the IAdaptable (or null
) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null
, it should minimally contain an adapter
for the org.eclipse.swt.widgets.Shell.class. Even if UI
information is provided, the implementation of this method
must be prepared for being called from a background thread.
Any UI access must be properly synchronized using the
techniques specified by the client's widget library.
OK
, and the caller requesting the undo will be
returned the status that caused the rejection. Any other status
severities will not be interpreted by the history.
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.