Class AbstractCopyCommand
- java.lang.Object
-
- org.eclipse.emf.common.command.AbstractCommand
-
- org.eclipse.emf.edit.command.ChangeCommand
-
- org.eclipse.emf.compare.command.impl.AbstractCopyCommand
-
- All Implemented Interfaces:
Command
,ICompareCopyCommand
- Direct Known Subclasses:
CopyCommand
,MergeAllNonConflictingCommand
,MergeCommand
public abstract class AbstractCopyCommand extends ChangeCommand implements ICompareCopyCommand
This command can be used to copy a number of diffs (or a single one) in a given direction.- Since:
- 3.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
AbstractCommand.NonDirtying
-
-
Field Summary
Fields Modifier and Type Field Description protected List<? extends Diff>
differences
The list of differences we are to merge.protected boolean
leftToRight
Direction of the merge operation.protected IMerger.Registry
mergerRegistry
Merger registry.-
Fields inherited from class org.eclipse.emf.edit.command.ChangeCommand
changeDescription, changeRecorder, notifier, notifiers
-
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label
-
-
Constructor Summary
Constructors Constructor Description AbstractCopyCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers, List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry)
Constructs an instance of this command given the list of differences that it needs to merge.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canExecute()
void
dispose()
Collection<?>
getAffectedObjects()
com.google.common.collect.Multimap<DifferenceState,Diff>
getChangedDiffs()
Returns the state changes to any diffs that this command produced.static com.google.common.collect.Multimap<DifferenceState,Diff>
getChangedDiffs(ChangeDescription changeDescription, Collection<? extends Diff> relevantDiffs)
Returns the state changes to any relevant diffs modified in the given change description.boolean
isLeftToRight()
Returns true if the command will be applied from left to right side, false otherwise.-
Methods inherited from class org.eclipse.emf.edit.command.ChangeCommand
createChangeRecorder, disposeChangeRecorder, doExecute, execute, getChangeDescription, getChangeRecorder, prepare, redo, setChangeDescription, undo
-
Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
canUndo, chain, getDescription, getLabel, getResult, setDescription, setLabel, toString
-
-
-
-
Field Detail
-
differences
protected final List<? extends Diff> differences
The list of differences we are to merge.
-
leftToRight
protected final boolean leftToRight
Direction of the merge operation.
-
mergerRegistry
protected final IMerger.Registry mergerRegistry
Merger registry.
-
-
Constructor Detail
-
AbstractCopyCommand
public AbstractCopyCommand(ChangeRecorder changeRecorder, Collection<Notifier> notifiers, List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry)
Constructs an instance of this command given the list of differences that it needs to merge.- Parameters:
changeRecorder
- The change recorder associated to this command.notifiers
- The collection of notifiers that will be notified of this command's execution.differences
- The list of differences that this command should merge.leftToRight
- The direction in whichdifferences
should be merged.mergerRegistry
- The registry of mergers.
-
-
Method Detail
-
isLeftToRight
public boolean isLeftToRight()
Returns true if the command will be applied from left to right side, false otherwise.- Specified by:
isLeftToRight
in interfaceICompareCopyCommand
- Returns:
- true if the command will be applied from left to right side, false otherwise.
- See Also:
ICompareCopyCommand.isLeftToRight()
-
getAffectedObjects
public Collection<?> getAffectedObjects()
- Specified by:
getAffectedObjects
in interfaceCommand
- Overrides:
getAffectedObjects
in classAbstractCommand
- See Also:
AbstractCommand.getAffectedObjects()
-
canExecute
public boolean canExecute()
- Specified by:
canExecute
in interfaceCommand
- Overrides:
canExecute
in classAbstractCommand
- See Also:
AbstractCommand.canExecute()
-
getChangedDiffs
public com.google.common.collect.Multimap<DifferenceState,Diff> getChangedDiffs()
Returns the state changes to any diffs that this command produced.- Returns:
- the state changes to any diffs that this command produced.
-
getChangedDiffs
public static com.google.common.collect.Multimap<DifferenceState,Diff> getChangedDiffs(ChangeDescription changeDescription, Collection<? extends Diff> relevantDiffs)
Returns the state changes to any relevant diffs modified in the given change description.- Parameters:
changeDescription
- the change description to process.relevantDiffs
- the diffs for which we can state changes in the map.- Returns:
- the state changes to any relevant diffs modified in the given change description.
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceCommand
- Overrides:
dispose
in classChangeCommand
-
-