public class UndoTransaction extends AbstractOperation
commit
at the end,
as simple as that! If it fails, call rollback
, but ALWAYS make sure either commit
or rollback
is called using try-catch-finally
, otherwise there may be leaks due to
history listeners.Constructor and Description |
---|
UndoTransaction(String description,
IUndoContext undoContext)
Constructor used to begin the undo transaction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canExecute() |
boolean |
canRedo() |
boolean |
canUndo() |
void |
commit()
Commits a series of operations in a transaction initiated with a prior
call to
begin . |
void |
dispose() |
IStatus |
execute(IProgressMonitor monitor,
IAdaptable info) |
IStatus |
redo(IProgressMonitor monitor,
IAdaptable info) |
boolean |
rollback(Shell shell,
boolean performUndo)
Performs a rollback.
|
IStatus |
undo(IProgressMonitor monitor,
IAdaptable info) |
addContext, getContexts, getLabel, hasContext, removeContext, setLabel, toString
public UndoTransaction(String description, IUndoContext undoContext)
It is very important to call commit
or rollback
in all cases, use try-catch-finally
to ensure this is done
even when exceptions occur.
description
- The description of the entire operation.public boolean rollback(Shell shell, boolean performUndo)
shell
- The shell, can be set to null if performUndo is false.performUndo
- Flag indicating that operations already performed should be undone as much as possible.
The operations that have been undone are removed from history, the ones not successful
are left without change and no "global" transaction undo operation is used.performUndo
is true. false indicates at least one operation failed to be undone,
true indicates all operations are undone.public void commit()
begin
.public void dispose()
dispose
in interface IUndoableOperation
dispose
in class AbstractOperation
public boolean canExecute()
canExecute
in interface IUndoableOperation
canExecute
in class AbstractOperation
public boolean canRedo()
canRedo
in interface IUndoableOperation
canRedo
in class AbstractOperation
public boolean canUndo()
canUndo
in interface IUndoableOperation
canUndo
in class AbstractOperation
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
execute
in interface IUndoableOperation
execute
in class AbstractOperation
ExecutionException
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
redo
in interface IUndoableOperation
redo
in class AbstractOperation
ExecutionException
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
undo
in interface IUndoableOperation
undo
in class AbstractOperation
ExecutionException
iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.