public class TransactionalDualCompareCommandStack extends Object implements ICompareCommandStack, IDisposable
ICompareCommandStack implementation that will delegate to two given command stacks; one for each
side of the comparison.
This implementation is one of the most robust delegating implementation we can do. If an error occurs during execution of a command, only the dirty state will be reset, all models will stay correct.
| Constructor and Description |
|---|
TransactionalDualCompareCommandStack(org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack leftCommandStack,
org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack rightCommandStack)
Creates an instance that delegates to two given
AbstractTransactionalCommandStack. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommandStackListener(CommandStackListener listener) |
boolean |
canRedo() |
boolean |
canUndo() |
void |
dispose() |
void |
execute(Command command) |
void |
flush() |
Command |
getMostRecentCommand() |
Command |
getRedoCommand() |
Command |
getUndoCommand() |
boolean |
isDeliver()
Returns whether delivery of notifications to
listeners is enabled. |
boolean |
isLeftSaveNeeded()
Returns whether the left model has changes since
ICompareCommandStack.leftSaveIsDone() was call the last. |
boolean |
isRightSaveNeeded()
Returns whether the right model has changes since
ICompareCommandStack.rightSaveIsDone() was call the last. |
void |
leftSaveIsDone()
Called after a save of the left model has been successfully performed.
|
protected void |
notifyListeners(CommandStack commandStack,
CommandStackEvent.Operation operation)
This is called to ensure that
CommandStackListener.commandStackChanged(java.util.EventObject) is called for each
listener. |
protected void |
notifyListeners(Object source)
Deprecated.
Override or call
instead. |
void |
redo() |
void |
removeCommandStackListener(CommandStackListener listener) |
void |
rightSaveIsDone()
Called after a save of the right model has been successfully performed.
|
void |
setDeliver(boolean deliver)
Sets whether delivery of notifications to
listeners is enabled. |
void |
undo() |
public TransactionalDualCompareCommandStack(org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack leftCommandStack,
org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack rightCommandStack)
AbstractTransactionalCommandStack.leftCommandStack - the left command stack.rightCommandStack - the right command stack.public void dispose()
dispose in interface IDisposableIDisposable.dispose()@Deprecated protected void notifyListeners(Object source)
instead.CommandStackListener.commandStackChanged(java.util.EventObject) is called for each
listener.source - the source of the event.protected void notifyListeners(CommandStack commandStack, CommandStackEvent.Operation operation)
CommandStackListener.commandStackChanged(java.util.EventObject) is called for each
listener.commandStack - the source of the event.operation - the operation of the event.public void execute(Command command)
execute in interface CommandStackCommandStack.execute(org.eclipse.emf.common.command.Command)public boolean canUndo()
canUndo in interface CommandStackCommandStack.canUndo()public void undo()
undo in interface CommandStackCommandStack.undo()public boolean canRedo()
canRedo in interface CommandStackCommandStack.canRedo()public Command getUndoCommand()
getUndoCommand in interface CommandStackCommandStack.getUndoCommand()public Command getRedoCommand()
getRedoCommand in interface CommandStackCommandStack.getRedoCommand()public Command getMostRecentCommand()
getMostRecentCommand in interface CommandStackCommandStack.getMostRecentCommand()public void redo()
redo in interface CommandStackCommandStack.redo()public void flush()
flush in interface CommandStackCommandStack.flush()public void addCommandStackListener(CommandStackListener listener)
addCommandStackListener in interface CommandStackCommandStack.addCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)public void removeCommandStackListener(CommandStackListener listener)
removeCommandStackListener in interface CommandStackCommandStack.removeCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)public boolean isLeftSaveNeeded()
ICompareCommandStack.leftSaveIsDone() was call the last.isLeftSaveNeeded in interface ICompareCommandStackICompareCommandStack.leftSaveIsDone() was call the last.ICompareCommandStack.isLeftSaveNeeded()public boolean isRightSaveNeeded()
ICompareCommandStack.rightSaveIsDone() was call the last.isRightSaveNeeded in interface ICompareCommandStackICompareCommandStack.rightSaveIsDone() was call the last.ICompareCommandStack.isRightSaveNeeded()public void leftSaveIsDone()
leftSaveIsDone in interface ICompareCommandStackICompareCommandStack.leftSaveIsDone()public void rightSaveIsDone()
rightSaveIsDone in interface ICompareCommandStackICompareCommandStack.rightSaveIsDone()public boolean isDeliver()
listeners is enabled.public void setDeliver(boolean deliver)
listeners is enabled. When delivery is enabled, the listeners are immediately notified.deliver - whether delivery of notifications is enabled.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.