|
|
|
|
org.eclipse.ui.operations
Class NonLocalUndoUserApprover
java.lang.Object
org.eclipse.ui.operations.NonLocalUndoUserApprover
-
All Implemented Interfaces:
-
IOperationApprover
-
public final class NonLocalUndoUserApprover
- extends
Object
- implements
IOperationApprover
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.
-
Since:
- 3.1
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
NonLocalUndoUserApprover
public NonLocalUndoUserApprover(
IUndoContext context,
IEditorPart part,
Object[] affectedObjects,
Class preferredComparisonClass)
- Create a NonLocalUndoUserApprover associated with the specified editor
and undo context
-
Parameters:
-
context - the undo context of operations in question. -
part - the editor part that is displaying the element -
affectedObjects - 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.
proceedRedoing
public
IStatus proceedRedoing(
IUndoableOperation operation,
IOperationHistory history,
IAdaptable uiInfo)
-
Description copied from interface:
IOperationApprover
- Return a status indicating whether the specified operation should be
redone. Any status that does not have severity
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.
-
-
Specified by:
-
proceedRedoing
in interface
IOperationApprover
-
-
Parameters:
-
operation - the operation to be redone -
history - the history redoing the operation -
uiInfo - 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.
-
Returns:
- the IStatus describing whether the operation is approved. The
redo will not proceed if the status severity is not
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.
proceedUndoing
public
IStatus proceedUndoing(
IUndoableOperation operation,
IOperationHistory history,
IAdaptable uiInfo)
-
Description copied from interface:
IOperationApprover
- Return a status indicating whether the specified operation should be
undone. Any status that does not have severity
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.
-
-
Specified by:
-
proceedUndoing
in interface
IOperationApprover
-
-
Parameters:
-
operation - the operation to be undone -
history - the history undoing the operation -
uiInfo - 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.
-
Returns:
- the IStatus describing whether the operation is approved. The
undo will not proceed if the status severity is not
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.
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.
|
|
|