Class DualCompareCommandStack
- java.lang.Object
-
- org.eclipse.emf.compare.command.impl.DualCompareCommandStack
-
- All Implemented Interfaces:
CommandStack,ICompareCommandStack,IDisposable
public class DualCompareCommandStack extends Object implements ICompareCommandStack, IDisposable
ICompareCommandStackimplementation 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
Constructors Constructor Description DualCompareCommandStack(BasicCommandStack leftCommandStack, BasicCommandStack rightCommandStack)Creates an instance that delegates to two givenBasicCommandStack.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCommandStackListener(CommandStackListener listener)booleancanRedo()booleancanUndo()voiddispose()voidexecute(Command command)voidflush()CommandgetMostRecentCommand()CommandgetRedoCommand()CommandgetUndoCommand()booleanisLeftSaveNeeded()Returns whether the left model has changes sinceICompareCommandStack.leftSaveIsDone()was call the last.booleanisRightSaveNeeded()Returns whether the right model has changes sinceICompareCommandStack.rightSaveIsDone()was call the last.voidleftSaveIsDone()Called 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()voidremoveCommandStackListener(CommandStackListener listener)voidrightSaveIsDone()Called after a save of the right model has been successfully performed.voidundo()
-
-
-
Constructor Detail
-
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 Detail
-
dispose
public void dispose()
- Specified by:
disposein interfaceIDisposable- See Also:
IDisposable.dispose()
-
notifyListeners
protected void notifyListeners(Object source)
This is called to ensure thatCommandStackListener.commandStackChanged(java.util.EventObject)is called for each listener.- Parameters:
source- the source of the notification
-
execute
public void execute(Command command)
- Specified by:
executein interfaceCommandStack- See Also:
CommandStack.execute(org.eclipse.emf.common.command.Command)
-
canUndo
public boolean canUndo()
- Specified by:
canUndoin interfaceCommandStack- See Also:
CommandStack.canUndo()
-
undo
public void undo()
- Specified by:
undoin interfaceCommandStack- See Also:
CommandStack.undo()
-
canRedo
public boolean canRedo()
- Specified by:
canRedoin interfaceCommandStack- See Also:
CommandStack.canRedo()
-
getUndoCommand
public Command getUndoCommand()
- Specified by:
getUndoCommandin interfaceCommandStack- See Also:
CommandStack.getUndoCommand()
-
getRedoCommand
public Command getRedoCommand()
- Specified by:
getRedoCommandin interfaceCommandStack- See Also:
CommandStack.getRedoCommand()
-
getMostRecentCommand
public Command getMostRecentCommand()
- Specified by:
getMostRecentCommandin interfaceCommandStack- See Also:
CommandStack.getMostRecentCommand()
-
redo
public void redo()
- Specified by:
redoin interfaceCommandStack- See Also:
CommandStack.redo()
-
flush
public void flush()
- Specified by:
flushin interfaceCommandStack- See Also:
CommandStack.flush()
-
addCommandStackListener
public void addCommandStackListener(CommandStackListener listener)
- Specified by:
addCommandStackListenerin interfaceCommandStack- See Also:
CommandStack.addCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
-
removeCommandStackListener
public void removeCommandStackListener(CommandStackListener listener)
- Specified by:
removeCommandStackListenerin interfaceCommandStack- See Also:
CommandStack.removeCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
-
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:
ICompareCommandStack.isLeftSaveNeeded()
-
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:
ICompareCommandStack.isRightSaveNeeded()
-
leftSaveIsDone
public void leftSaveIsDone()
Called after a save of the left model has been successfully performed.- Specified by:
leftSaveIsDonein interfaceICompareCommandStack- See Also:
ICompareCommandStack.leftSaveIsDone()
-
rightSaveIsDone
public void rightSaveIsDone()
Called after a save of the right model has been successfully performed.- Specified by:
rightSaveIsDonein interfaceICompareCommandStack- See Also:
ICompareCommandStack.rightSaveIsDone()
-
-