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 simpleICompareCommandStack
that delegate execution to another command stack but keep informations about execution to properly reply toICompareCommandStack
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
Nested Classes Modifier and Type Class Description static class
CompareCommandStack.CompareSideCommandStack
Simple 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 CommandStack
delegate()
Returns the backing delegate instance that methods are forwarded to.void
dispose()
void
execute(Command command)
void
flush()
boolean
isLeftSaveNeeded()
Returns whether the left model has changes sinceICompareCommandStack.leftSaveIsDone()
was call the last.boolean
isRightSaveNeeded()
Returns whether the right model has changes sinceICompareCommandStack.rightSaveIsDone()
was call the last.void
leftSaveIsDone()
Called after a save of the left model has been successfully performed.void
redo()
void
rightSaveIsDone()
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 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:
dispose
in interfaceIDisposable
- See Also:
IDisposable.dispose()
-
delegate
protected CommandStack 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:
DelegatingCommandStack.delegate()
-
execute
public void execute(Command command)
- Specified by:
execute
in interfaceCommandStack
- Overrides:
execute
in classDelegatingCommandStack
- See Also:
DelegatingCommandStack.execute(org.eclipse.emf.common.command.Command)
-
undo
public void undo()
- Specified by:
undo
in interfaceCommandStack
- Overrides:
undo
in classDelegatingCommandStack
- See Also:
BasicCommandStack.undo()
-
redo
public void redo()
- Specified by:
redo
in interfaceCommandStack
- Overrides:
redo
in classDelegatingCommandStack
- See Also:
BasicCommandStack.redo()
-
flush
public void flush()
- Specified by:
flush
in interfaceCommandStack
- Overrides:
flush
in classDelegatingCommandStack
- See Also:
CommandStack.flush()
-
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:
ICompareCommandStack.isLeftSaveNeeded()
-
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:
ICompareCommandStack.isRightSaveNeeded()
-
leftSaveIsDone
public void leftSaveIsDone()
Called after a save of the left model has been successfully performed.- Specified by:
leftSaveIsDone
in interfaceICompareCommandStack
- See Also:
ICompareCommandStack.leftSaveIsDone()
-
rightSaveIsDone
public void rightSaveIsDone()
Called after a save of the right model has been successfully performed.- Specified by:
rightSaveIsDone
in interfaceICompareCommandStack
- See Also:
ICompareCommandStack.rightSaveIsDone()
-
-