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
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
Modifier and TypeFieldDescriptionThe list of differences we are to merge.protected final boolean
Direction of the merge operation.protected final IMerger.Registry
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
ConstructorDescriptionAbstractCopyCommand
(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
Modifier and TypeMethodDescriptionboolean
void
dispose()
Collection<?>
com.google.common.collect.Multimap<DifferenceState,
Diff> 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
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 Details
-
differences
The list of differences we are to merge. -
leftToRight
protected final boolean leftToRightDirection of the merge operation. -
mergerRegistry
Merger registry.
-
-
Constructor Details
-
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 Details
-
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:
-
getAffectedObjects
- Specified by:
getAffectedObjects
in interfaceCommand
- Overrides:
getAffectedObjects
in classAbstractCommand
- See Also:
-
canExecute
public boolean canExecute()- Specified by:
canExecute
in interfaceCommand
- Overrides:
canExecute
in classAbstractCommand
- See Also:
-
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
-