Class DualCompareCommandStack
java.lang.Object
org.eclipse.emf.compare.command.impl.DualCompareCommandStack
- All Implemented Interfaces:
CommandStack,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 Summary
ConstructorsConstructorDescriptionDualCompareCommandStack(BasicCommandStack leftCommandStack, BasicCommandStack rightCommandStack) Creates an instance that delegates to two givenBasicCommandStack. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommandStackListener(CommandStackListener listener) booleancanRedo()booleancanUndo()voiddispose()voidvoidflush()booleanReturns whether the left model has changes sinceICompareCommandStack.leftSaveIsDone()was call the last.booleanReturns whether the right model has changes sinceICompareCommandStack.rightSaveIsDone()was call the last.voidCalled after a save of the left model has been successfully performed.protected voidnotifyListeners(Object source) This is called to ensure thatCommandStackListener.commandStackChanged(java.util.EventObject)is called for each listener.voidredo()voidvoidCalled after a save of the right model has been successfully performed.voidundo()
-
Constructor Details
-
DualCompareCommandStack
public DualCompareCommandStack(BasicCommandStack leftCommandStack, BasicCommandStack rightCommandStack) Creates an instance that delegates to two givenBasicCommandStack.- Parameters:
leftCommandStack- the left command stack.rightCommandStack- the right command stack.
-
-
Method Details
-
dispose
public void dispose()- Specified by:
disposein interfaceIDisposable- See Also:
-
notifyListeners
This is called to ensure thatCommandStackListener.commandStackChanged(java.util.EventObject)is called for each listener.- Parameters:
source- the source of the notification
-
execute
- Specified by:
executein interfaceCommandStack- See Also:
-
canUndo
public boolean canUndo()- Specified by:
canUndoin interfaceCommandStack- See Also:
-
undo
public void undo()- Specified by:
undoin interfaceCommandStack- See Also:
-
canRedo
public boolean canRedo()- Specified by:
canRedoin interfaceCommandStack- See Also:
-
getUndoCommand
- Specified by:
getUndoCommandin interfaceCommandStack- See Also:
-
getRedoCommand
- Specified by:
getRedoCommandin interfaceCommandStack- See Also:
-
getMostRecentCommand
- Specified by:
getMostRecentCommandin interfaceCommandStack- See Also:
-
redo
public void redo()- Specified by:
redoin interfaceCommandStack- See Also:
-
flush
public void flush()- Specified by:
flushin interfaceCommandStack- See Also:
-
addCommandStackListener
- Specified by:
addCommandStackListenerin interfaceCommandStack- See Also:
-
removeCommandStackListener
- Specified by:
removeCommandStackListenerin interfaceCommandStack- See Also:
-
isLeftSaveNeeded
public boolean isLeftSaveNeeded()Returns whether the left model has changes sinceICompareCommandStack.leftSaveIsDone()was call the last.- Specified by:
isLeftSaveNeededin interfaceICompareCommandStack- Returns:
- whether the left model has changes since
ICompareCommandStack.leftSaveIsDone()was call the last. - See Also:
-
isRightSaveNeeded
public boolean isRightSaveNeeded()Returns whether the right model has changes sinceICompareCommandStack.rightSaveIsDone()was call the last.- Specified by:
isRightSaveNeededin interfaceICompareCommandStack- Returns:
- whether the right model has changes since
ICompareCommandStack.rightSaveIsDone()was call the last. - See Also:
-
leftSaveIsDone
public void leftSaveIsDone()Called after a save of the left model has been successfully performed.- Specified by:
leftSaveIsDonein interfaceICompareCommandStack- See Also:
-
rightSaveIsDone
public void rightSaveIsDone()Called after a save of the right model has been successfully performed.- Specified by:
rightSaveIsDonein interfaceICompareCommandStack- See Also:
-