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 and Description |
---|
TransactionalDualCompareCommandStack(org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack leftCommandStack,
org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack rightCommandStack)
Creates an instance that delegates to two given
AbstractTransactionalCommandStack . |
Modifier and Type | Method and Description |
---|---|
void |
addCommandStackListener(CommandStackListener listener) |
boolean |
canRedo() |
boolean |
canUndo() |
void |
dispose() |
void |
execute(Command command) |
void |
flush() |
Command |
getMostRecentCommand() |
Command |
getRedoCommand() |
Command |
getUndoCommand() |
boolean |
isDeliver()
Returns whether delivery of notifications to
listeners is enabled. |
boolean |
isLeftSaveNeeded()
Returns whether the left model has changes since
ICompareCommandStack.leftSaveIsDone() was call the last. |
boolean |
isRightSaveNeeded()
Returns whether the right model has changes since
ICompareCommandStack.rightSaveIsDone() was call the last. |
void |
leftSaveIsDone()
Called after a save of the left model has been successfully performed.
|
protected void |
notifyListeners(CommandStack commandStack,
CommandStackEvent.Operation operation)
This is called to ensure that
CommandStackListener.commandStackChanged(java.util.EventObject) is called for each
listener. |
protected void |
notifyListeners(Object source)
Deprecated.
Override or call
instead . |
void |
redo() |
void |
removeCommandStackListener(CommandStackListener listener) |
void |
rightSaveIsDone()
Called after a save of the right model has been successfully performed.
|
void |
setDeliver(boolean deliver)
Sets whether delivery of notifications to
listeners is enabled. |
void |
undo() |
public TransactionalDualCompareCommandStack(org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack leftCommandStack, org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack rightCommandStack)
AbstractTransactionalCommandStack
.leftCommandStack
- the left command stack.rightCommandStack
- the right command stack.public void dispose()
dispose
in interface IDisposable
IDisposable.dispose()
@Deprecated protected void notifyListeners(Object source)
instead
.CommandStackListener.commandStackChanged(java.util.EventObject)
is called for each
listener.source
- the source of the event.protected void notifyListeners(CommandStack commandStack, CommandStackEvent.Operation operation)
CommandStackListener.commandStackChanged(java.util.EventObject)
is called for each
listener.commandStack
- the source of the event.operation
- the operation of the event.public void execute(Command command)
execute
in interface CommandStack
CommandStack.execute(org.eclipse.emf.common.command.Command)
public boolean canUndo()
canUndo
in interface CommandStack
CommandStack.canUndo()
public void undo()
undo
in interface CommandStack
CommandStack.undo()
public boolean canRedo()
canRedo
in interface CommandStack
CommandStack.canRedo()
public Command getUndoCommand()
getUndoCommand
in interface CommandStack
CommandStack.getUndoCommand()
public Command getRedoCommand()
getRedoCommand
in interface CommandStack
CommandStack.getRedoCommand()
public Command getMostRecentCommand()
getMostRecentCommand
in interface CommandStack
CommandStack.getMostRecentCommand()
public void redo()
redo
in interface CommandStack
CommandStack.redo()
public void flush()
flush
in interface CommandStack
CommandStack.flush()
public void addCommandStackListener(CommandStackListener listener)
addCommandStackListener
in interface CommandStack
CommandStack.addCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
public void removeCommandStackListener(CommandStackListener listener)
removeCommandStackListener
in interface CommandStack
CommandStack.removeCommandStackListener(org.eclipse.emf.common.command.CommandStackListener)
public boolean isLeftSaveNeeded()
ICompareCommandStack.leftSaveIsDone()
was call the last.isLeftSaveNeeded
in interface ICompareCommandStack
ICompareCommandStack.leftSaveIsDone()
was call the last.ICompareCommandStack.isLeftSaveNeeded()
public boolean isRightSaveNeeded()
ICompareCommandStack.rightSaveIsDone()
was call the last.isRightSaveNeeded
in interface ICompareCommandStack
ICompareCommandStack.rightSaveIsDone()
was call the last.ICompareCommandStack.isRightSaveNeeded()
public void leftSaveIsDone()
leftSaveIsDone
in interface ICompareCommandStack
ICompareCommandStack.leftSaveIsDone()
public void rightSaveIsDone()
rightSaveIsDone
in interface ICompareCommandStack
ICompareCommandStack.rightSaveIsDone()
public boolean isDeliver()
listeners
is enabled.public void setDeliver(boolean deliver)
listeners
is enabled. When delivery is enabled, the listeners are immediately notified.deliver
- whether delivery of notifications is enabled.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.