Package com.iizigo.editor
Class UndoTransaction
java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
com.iizigo.editor.UndoTransaction
- All Implemented Interfaces:
- IUndoableOperation
Class used to create transactions in the operations history. Construct a new UndoTransaction instance to start the transaction, and call 
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.- Author:
- Christopher Mindus
- Constructor SummaryConstructorsConstructorDescription- UndoTransaction- (String description, IUndoContext undoContext) Constructor used to begin the undo transaction.
- Method SummaryModifier and TypeMethodDescription- boolean- boolean- canRedo()- boolean- canUndo()- void- commit()Commits a series of operations in a transaction initiated with a prior call to- begin.- void- dispose()- execute- (IProgressMonitor monitor, IAdaptable info) - redo- (IProgressMonitor monitor, IAdaptable info) - booleanPerforms a rollback.- undo- (IProgressMonitor monitor, IAdaptable info) - Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation- addContext, getContexts, getLabel, hasContext, removeContext, setLabel, toString
- Constructor Details- UndoTransactionConstructor used to begin the undo transaction.- It is very important to call - commitor- rollbackin all cases, use- try-catch-finallyto ensure this is done even when exceptions occur.- Parameters:
- description- The description of the entire operation.
 
 
- Method Details- rollbackPerforms a rollback.- Parameters:
- 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.
- Returns:
- Success flag when performUndois true. false indicates at least one operation failed to be undone, true indicates all operations are undone.
 
- commitpublic void commit()Commits a series of operations in a transaction initiated with a prior call to- begin.
- disposepublic void dispose()- Specified by:
- disposein interface- IUndoableOperation
- Overrides:
- disposein class- AbstractOperation
 
- canExecutepublic boolean canExecute()- Specified by:
- canExecutein interface- IUndoableOperation
- Overrides:
- canExecutein class- AbstractOperation
 
- canRedopublic boolean canRedo()- Specified by:
- canRedoin interface- IUndoableOperation
- Overrides:
- canRedoin class- AbstractOperation
 
- canUndopublic boolean canUndo()- Specified by:
- canUndoin interface- IUndoableOperation
- Overrides:
- canUndoin class- AbstractOperation
 
- execute- Specified by:
- executein interface- IUndoableOperation
- Specified by:
- executein class- AbstractOperation
- Throws:
- ExecutionException
 
- redo- Specified by:
- redoin interface- IUndoableOperation
- Specified by:
- redoin class- AbstractOperation
- Throws:
- ExecutionException
 
- undo- Specified by:
- undoin interface- IUndoableOperation
- Specified by:
- undoin class- AbstractOperation
- Throws:
- ExecutionException