|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.core.commands.operations.AbstractOperation
Abstract implementation for an undoable operation. At a minimum, subclasses
should implement behavior for
IUndoableOperation.execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable),
IUndoableOperation.redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable),
and
IUndoableOperation.undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable).
IUndoableOperation| Constructor Summary | |
|---|---|
AbstractOperation(String label)
Construct an operation that has the specified label. |
|
| Method Summary | |
|---|---|
void |
addContext(IUndoContext context)
Add the specified context to the operation. |
boolean |
canExecute()
Returns whether the operation can be executed in its current state. |
boolean |
canRedo()
Returns whether the operation can be redone in its current state. |
boolean |
canUndo()
Returns whether the operation can be undone in its current state. |
void |
dispose()
Dispose of the operation. |
abstract IStatus |
execute(IProgressMonitor monitor,
IAdaptable info)
Execute the operation. |
IUndoContext[] |
getContexts()
Returns the array of contexts that have been assigned to the operation. |
String |
getLabel()
Return the label that should be used to show the name of the operation to the user. |
boolean |
hasContext(IUndoContext context)
Returns whether the operation has a matching context for the specified context. |
abstract IStatus |
redo(IProgressMonitor monitor,
IAdaptable info)
Redo the operation. |
void |
removeContext(IUndoContext context)
Remove the specified context from the operation. |
void |
setLabel(String name)
Set the label of the operation to the specified name. |
String |
toString()
The string representation of this operation. |
abstract IStatus |
undo(IProgressMonitor monitor,
IAdaptable info)
Undo the operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AbstractOperation(String label)
label - the label to be used for the operation.| Method Detail |
public void addContext(IUndoContext context)
IUndoableOperation
Add the specified context to the operation. If a context equal to the
specified context is already present, do not add it again. Note that
determining whether a context is already present is based on equality,
not whether the context matches (IUndoContext.matches(IUndoContext))
another context.
addContext in interface IUndoableOperationcontext - the context to be addedpublic boolean canExecute()
IUndoableOperationReturns whether the operation can be executed in its current state.
Note: The computation for this method must be fast, as it is called frequently. If necessary, this method can be optimistic in its computation (returning true) and later perform more time-consuming computations during the actual execution of the operation, returning the appropriate status if the operation cannot actually execute at that time.
canExecute in interface IUndoableOperationtrue if the operation can be executed;
false otherwise.public boolean canRedo()
IUndoableOperationReturns whether the operation can be redone in its current state.
Note: The computation for this method must be fast, as it is called frequently. If necessary, this method can be optimistic in its computation (returning true) and later perform more time-consuming computations during the actual redo of the operation, returning the appropriate status if the operation cannot actually be redone at that time.
canRedo in interface IUndoableOperationtrue if the operation can be redone;
false otherwise.public boolean canUndo()
IUndoableOperationReturns whether the operation can be undone in its current state.
Note: The computation for this method must be fast, as it is called frequently. If necessary, this method can be optimistic in its computation (returning true) and later perform more time-consuming computations during the actual undo of the operation, returning the appropriate status if the operation cannot actually be undone at that time.
canUndo in interface IUndoableOperationtrue if the operation can be undone;
false otherwise.public void dispose()
IUndoableOperation
dispose in interface IUndoableOperation
public abstract IStatus execute(IProgressMonitor monitor,
IAdaptable info)
throws ExecutionException
IUndoableOperation
execute in interface IUndoableOperationmonitor - the progress monitor (or null) to use for
reporting progress to the user.info - 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.
OK if the operation was successful, and
ERROR if it was not. Any other status is assumed
to represent an incompletion of the execution.
ExecutionException - if an exception occurred during execution.public final IUndoContext[] getContexts()
IUndoableOperationReturns the array of contexts that have been assigned to the operation.
This method may be called by the operation history from inside a synchronized block. To avoid deadlock conditions, implementers of this method must avoid dispatching and waiting on threads that modify the operation history during this method.
getContexts in interface IUndoableOperationpublic String getLabel()
IUndoableOperation
getLabel in interface IUndoableOperationpublic void setLabel(String name)
name - the string to be used for the label.public final boolean hasContext(IUndoContext context)
IUndoableOperationReturns whether the operation has a matching context for the specified context.
This method may be called by the operation history from inside a synchronized block. To avoid deadlock conditions, implementers of this method must avoid dispatching and waiting on threads that modify the operation history during this method.
hasContext in interface IUndoableOperationcontext - the context in question
true if the context is present, false
if it is not.IUndoContext.matches(IUndoContext)
public abstract IStatus redo(IProgressMonitor monitor,
IAdaptable info)
throws ExecutionException
IUndoableOperation
redo in interface IUndoableOperationmonitor - the progress monitor (or null) to use for
reporting progress to the user.info - 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.
OK if the redo was successful, and
ERROR if it was not. Any other status is assumed
to represent an incompletion of the redo.
ExecutionException - if an exception occurred during redo.public void removeContext(IUndoContext context)
IUndoableOperationIUndoContext.matches(IUndoContext)) another context.
removeContext in interface IUndoableOperationcontext - the context to be removed
public abstract IStatus undo(IProgressMonitor monitor,
IAdaptable info)
throws ExecutionException
IUndoableOperation
undo in interface IUndoableOperationmonitor - the progress monitor (or null) to use for
reporting progress to the user.info - 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.
OK if the redo was successful, and
ERROR if it was not. Any other status is assumed
to represent an incompletion of the undo.
ExecutionException - if an exception occurred during undo.public String toString()
|
Eclipse Platform Release 3.3 |
|||||||||||
| 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, 2007. All rights reserved.