Class CompareCommandStack
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- org.eclipse.emf.compare.command.DelegatingCommandStack
-
- org.eclipse.emf.compare.command.impl.CompareCommandStack
-
- All Implemented Interfaces:
CommandStack,ICompareCommandStack,IDisposable
public class CompareCommandStack extends DelegatingCommandStack implements ICompareCommandStack, IDisposable
A simpleICompareCommandStackthat delegate execution to another command stack but keep informations about execution to properly reply toICompareCommandStackprotocol.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompareCommandStack.CompareSideCommandStackSimple data structure acting like a command stack but without any execution capability.
-
Constructor Summary
Constructors Constructor Description CompareCommandStack(CommandStack commandStack)Creates a new instance that delegates to the givencommandStack.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CommandStackdelegate()Returns the backing delegate instance that methods are forwarded to.voiddispose()voidexecute(Command command)voidflush()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.voidredo()voidrightSaveIsDone()Called after a save of the right model has been successfully performed.voidundo()-
Methods inherited from class org.eclipse.emf.compare.command.DelegatingCommandStack
addCommandStackListener, canRedo, canUndo, getMostRecentCommand, getRedoCommand, getUndoCommand, notifyListeners, removeCommandStackListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.emf.common.command.CommandStack
addCommandStackListener, canRedo, canUndo, getMostRecentCommand, getRedoCommand, getUndoCommand, removeCommandStackListener
-
-
-
-
Constructor Detail
-
CompareCommandStack
public CompareCommandStack(CommandStack commandStack)
Creates a new instance that delegates to the givencommandStack.- Parameters:
commandStack- the command stack to which this instance will delegate.
-
-
Method Detail
-
dispose
public void dispose()
- Specified by:
disposein interfaceIDisposable- See Also:
IDisposable.dispose()
-
delegate
protected CommandStack delegate()
Returns the backing delegate instance that methods are forwarded to.- Specified by:
delegatein classDelegatingCommandStack- Returns:
- the backing delegate instance that methods are forwarded to.
- See Also:
DelegatingCommandStack.delegate()
-
execute
public void execute(Command command)
- Specified by:
executein interfaceCommandStack- Overrides:
executein classDelegatingCommandStack- See Also:
DelegatingCommandStack.execute(org.eclipse.emf.common.command.Command)
-
undo
public void undo()
- Specified by:
undoin interfaceCommandStack- Overrides:
undoin classDelegatingCommandStack- See Also:
BasicCommandStack.undo()
-
redo
public void redo()
- Specified by:
redoin interfaceCommandStack- Overrides:
redoin classDelegatingCommandStack- See Also:
BasicCommandStack.redo()
-
flush
public void flush()
- Specified by:
flushin interfaceCommandStack- Overrides:
flushin classDelegatingCommandStack- See Also:
CommandStack.flush()
-
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()
-
-