Class TransactionalDualCompareCommandStack
java.lang.Object
org.eclipse.emf.compare.command.impl.TransactionalDualCompareCommandStack
- All Implemented Interfaces:
CommandStack
,ICompareCommandStack
,IDisposable
public class TransactionalDualCompareCommandStack
extends Object
implements ICompareCommandStack, IDisposable
ICompareCommandStack
implementation that will delegate to two given command stacks; one for each
side of the comparison.
This implementation is one of the most robust delegating implementation we can do. If an error occurs during execution of a command, only the dirty state will be reset, all models will stay correct.
-
Constructor Summary
ConstructorDescriptionTransactionalDualCompareCommandStack
(org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack leftCommandStack, org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack rightCommandStack) Creates an instance that delegates to two givenAbstractTransactionalCommandStack
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommandStackListener
(CommandStackListener listener) boolean
canRedo()
boolean
canUndo()
void
dispose()
void
void
flush()
boolean
Returns whether delivery of notifications tolisteners
is enabled.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.protected void
notifyListeners
(Object source) Deprecated.protected void
notifyListeners
(CommandStack commandStack, CommandStackEvent.Operation operation) This is called to ensure thatCommandStackListener.commandStackChanged(java.util.EventObject)
is called for each listener.void
redo()
void
void
Called after a save of the right model has been successfully performed.void
setDeliver
(boolean deliver) Sets whether delivery of notifications tolisteners
is enabled.void
undo()
-
Constructor Details
-
TransactionalDualCompareCommandStack
public TransactionalDualCompareCommandStack(org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack leftCommandStack, org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack rightCommandStack) Creates an instance that delegates to two givenAbstractTransactionalCommandStack
.- Parameters:
leftCommandStack
- the left command stack.rightCommandStack
- the right command stack.
-
-
Method Details
-
dispose
public void dispose()- Specified by:
dispose
in interfaceIDisposable
- See Also:
-
notifyListeners
Deprecated.Override or callinstead
.This is called to ensure thatCommandStackListener.commandStackChanged(java.util.EventObject)
is called for each listener.- Parameters:
source
- the source of the event.
-
notifyListeners
This is called to ensure thatCommandStackListener.commandStackChanged(java.util.EventObject)
is called for each listener.- Parameters:
commandStack
- the source of the event.operation
- the operation of the event.
-
execute
- Specified by:
execute
in interfaceCommandStack
- See Also:
-
canUndo
public boolean canUndo()- Specified by:
canUndo
in interfaceCommandStack
- See Also:
-
undo
public void undo()- Specified by:
undo
in interfaceCommandStack
- See Also:
-
canRedo
public boolean canRedo()- Specified by:
canRedo
in interfaceCommandStack
- See Also:
-
getUndoCommand
- Specified by:
getUndoCommand
in interfaceCommandStack
- See Also:
-
getRedoCommand
- Specified by:
getRedoCommand
in interfaceCommandStack
- See Also:
-
getMostRecentCommand
- Specified by:
getMostRecentCommand
in interfaceCommandStack
- See Also:
-
redo
public void redo()- Specified by:
redo
in interfaceCommandStack
- See Also:
-
flush
public void flush()- Specified by:
flush
in interfaceCommandStack
- See Also:
-
addCommandStackListener
- Specified by:
addCommandStackListener
in interfaceCommandStack
- See Also:
-
removeCommandStackListener
- Specified by:
removeCommandStackListener
in interfaceCommandStack
- 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:
-
isDeliver
public boolean isDeliver()Returns whether delivery of notifications tolisteners
is enabled.- Returns:
- whether delivery of notifications is enabled.
-
setDeliver
public void setDeliver(boolean deliver) Sets whether delivery of notifications tolisteners
is enabled. When delivery is enabled, the listeners are immediately notified.- Parameters:
deliver
- whether delivery of notifications is enabled.
-
instead
.