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 simple
ICompareCommandStack
that delegate execution to another command stack but keep
informations about execution to properly reply to ICompareCommandStack
protocol.
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
Modifier and TypeClassDescriptionstatic class
Simple data structure acting like a command stack but without any execution capability. -
Constructor Summary
ConstructorDescriptionCompareCommandStack
(CommandStack commandStack) Creates a new instance that delegates to the givencommandStack
. -
Method Summary
Modifier and TypeMethodDescriptionprotected CommandStack
delegate()
Returns the backing delegate instance that methods are forwarded to.void
dispose()
void
void
flush()
boolean
Returns whether the left model has changes sinceICompareCommandStack.leftSaveIsDone()
was call the last.boolean
Returns whether the right model has changes sinceICompareCommandStack.rightSaveIsDone()
was call the last.void
Called after a save of the left model has been successfully performed.void
redo()
void
Called after a save of the right model has been successfully performed.void
undo()
Methods inherited from class org.eclipse.emf.compare.command.DelegatingCommandStack
addCommandStackListener, canRedo, canUndo, getMostRecentCommand, getRedoCommand, getUndoCommand, notifyListeners, removeCommandStackListener
Methods inherited from class com.google.common.collect.ForwardingObject
toString
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 Details
-
CompareCommandStack
Creates a new instance that delegates to the givencommandStack
.- Parameters:
commandStack
- the command stack to which this instance will delegate.
-
-
Method Details
-
dispose
public void dispose()- Specified by:
dispose
in interfaceIDisposable
- See Also:
-
delegate
Returns the backing delegate instance that methods are forwarded to.- Specified by:
delegate
in classDelegatingCommandStack
- Returns:
- the backing delegate instance that methods are forwarded to.
- See Also:
-
execute
- Specified by:
execute
in interfaceCommandStack
- Overrides:
execute
in classDelegatingCommandStack
- See Also:
-
undo
public void undo()- Specified by:
undo
in interfaceCommandStack
- Overrides:
undo
in classDelegatingCommandStack
- See Also:
-
redo
public void redo()- Specified by:
redo
in interfaceCommandStack
- Overrides:
redo
in classDelegatingCommandStack
- See Also:
-
flush
public void flush()- Specified by:
flush
in interfaceCommandStack
- Overrides:
flush
in classDelegatingCommandStack
- See Also:
-
isLeftSaveNeeded
public boolean isLeftSaveNeeded()Returns whether the left model has changes sinceICompareCommandStack.leftSaveIsDone()
was call the last.- Specified by:
isLeftSaveNeeded
in 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:
isRightSaveNeeded
in 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:
leftSaveIsDone
in interfaceICompareCommandStack
- See Also:
-
rightSaveIsDone
public void rightSaveIsDone()Called after a save of the right model has been successfully performed.- Specified by:
rightSaveIsDone
in interfaceICompareCommandStack
- See Also:
-