public class DualCompareCommandStack extends Object implements ICompareCommandStack, IDisposable
ICompareCommandStack implementation that will delegates to two given command stacks; one for each
side of the comparison.
This implementation is not robust. If an error occurs during execution of a command, the whole state will be corrupted and the undo/redo may have an unknown behavior.
| Constructor and Description |
|---|
DualCompareCommandStack(BasicCommandStack leftCommandStack,
BasicCommandStack rightCommandStack)
Creates an instance that delegates to two given
BasicCommandStack. |
| 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 |
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(Object source)
This is called to ensure that
CommandStackListener.commandStackChanged(java.util.EventObject) is called for each
listener. |
void |
redo() |
void |
removeCommandStackListener(CommandStackListener listener) |
void |
rightSaveIsDone()
Called after a save of the right model has been successfully performed.
|
void |
undo() |
public DualCompareCommandStack(BasicCommandStack leftCommandStack, BasicCommandStack rightCommandStack)
BasicCommandStack.leftCommandStack - the left command stack.rightCommandStack - the right command stack.public void dispose()
dispose in interface IDisposableIDisposable.dispose()protected void notifyListeners(Object source)
CommandStackListener.commandStackChanged(java.util.EventObject) is called for each
listener.source - the source of the notificationpublic 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()
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.