Package org.eclipse.emf.compare.domain.impl

## Class EMFCompareEditingDomain

- java.lang.Object
- - org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain

All Implemented Interfaces:
  `ICompareEditingDomain`, `IDisposable`

    public class EMFCompareEditingDomain
    extends Object
    implements ICompareEditingDomain, IDisposable

Default implementation that use a change recorder in the background to record the changes made by executed commands.

### Constructor Summary

Constructors
`EMFCompareEditingDomain​(Notifier left, Notifier right, Notifier ancestor, ICompareCommandStack commandStack)` Creates a new instance with the given notifiers to be listen to when something will be changed.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static ICompareEditingDomain` `create​(Notifier left, Notifier right, Notifier ancestor)` Creates a new compare editing domain on the given notifier with an appropriate `ICompareCommandStack` set up on it.
`static ICompareEditingDomain` `create​(Notifier left, Notifier right, Notifier ancestor, CommandStack commandStack)` Equivalent to `create(left, right, ancestor, commandStack, null)`.
`static ICompareEditingDomain` `create​(Notifier left, Notifier right, Notifier ancestor, CommandStack leftCommandStack, CommandStack rightCommandStack)` Creates a new compare editing domain on the given notifier with an appropriate `ICompareCommandStack` set up on it.
`ICompareCopyCommand` `createCopyAllNonConflictingCommand​(Comparison comparison, boolean leftToRight, IMerger.Registry mergerRegistry, IMergeAllNonConflictingRunnable runnable)` Creates a command that will merge all non-conflicting differences in the given direction.
`Command` `createCopyCommand​(List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry)` Creates a new command that will merge the given differences in from right to left or left to right by using the mergers defined in the given merger registry.
`ICompareCopyCommand` `createCopyCommand​(List<? extends Diff> differences, boolean leftToRight, IMerger.Registry mergerRegistry, IMergeRunnable runnable)` Creates a new command that will execute the given `IMergeRunnable` that is expected to merge the given differences in from right to left or left to right by using the mergers defined in the given merger registry.
`void` `dispose()`
`ChangeRecorder` `getChangeRecorder()` Returns the associated `ChangeRecorder`.
`ICompareCommandStack` `getCommandStack()` Returns the associated `ICompareCommandStack`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### EMFCompareEditingDomain

    public EMFCompareEditingDomain​(Notifier left,
                                   Notifier right,
                                   Notifier ancestor,
                                   ICompareCommandStack commandStack)

Creates a new instance with the given notifiers to be listen to when something will be changed.

Parameters:
  `left` - the left root notifier of the comparison (i.e. the `IComparisonScope.getLeft()`
  `right` - the right root notifier of the comparison (i.e. the `IComparisonScope.getRight()`
  `ancestor` - the ancestor root notifier of the comparison (i.e. the `IComparisonScope.getOrigin()`
  `commandStack` - the command stack to be used to track execution of commands.

### Method Detail

#### create

    public static ICompareEditingDomain create​(Notifier left,
                                               Notifier right,
                                               Notifier ancestor)

Creates a new compare editing domain on the given notifier with an appropriate `ICompareCommandStack` set up on it.

Parameters:
  `left` - the left notifier. Should not be `null`.
  `right` - the right notifier. Should not be `null`.
  `ancestor` - the ancestor notifier. May be `null`.
Returns:
  a new compare editing domain on the given notifier.

#### create

    public static ICompareEditingDomain create​(Notifier left,
                                               Notifier right,
                                               Notifier ancestor,
                                               CommandStack commandStack)

Equivalent to `create(left, right, ancestor, commandStack, null)`.

Parameters:
  `left` - the left notifier. Should not be `null`.
  `right` - the right notifier. Should not be `null`.
  `ancestor` - the ancestor notifier. May be `null`.
  `commandStack` - a command stack to which merge command will be delegated to.
Returns:
  a newly created compare editing domain.

#### create

    public static ICompareEditingDomain create​(Notifier left,
                                               Notifier right,
                                               Notifier ancestor,
                                               CommandStack leftCommandStack,
                                               CommandStack rightCommandStack)

Creates a new compare editing domain on the given notifier with an appropriate `ICompareCommandStack` set up on it.

Parameters:
  `left` - the left notifier. Should not be `null`.
  `right` - the right notifier. Should not be `null`.
  `ancestor` - the ancestor notifier. May be `null`.
  `leftCommandStack` - a command stack to which merge to left command will be delegated to.
  `rightCommandStack` - a command stack to which merge to irght command will be delegated to.
Returns:
  a newly created compare editing domain.

#### dispose

    public void dispose()

Specified by:
  `dispose` in interface `IDisposable`
See Also:
  `org.eclipse.emf.compare.domain.ICompareEditingDomain#dispose()`

#### getCommandStack

    public ICompareCommandStack getCommandStack()

Returns the associated `ICompareCommandStack`.

Specified by:
  `getCommandStack` in interface `ICompareEditingDomain`
Returns:
  the associated `ICompareCommandStack`.
See Also:
  `ICompareEditingDomain.getCommandStack()`

#### createCopyCommand

    public Command createCopyCommand​(List<? extends Diff> differences,
                                     boolean leftToRight,
                                     IMerger.Registry mergerRegistry)

Creates a new command that will merge the given differences in from right to left or left to right by using the mergers defined in the given merger registry.

Specified by:
  `createCopyCommand` in interface `ICompareEditingDomain`
Parameters:
  `differences` - the differences to merge.
  `leftToRight` - whether the merge has to be merge from left to right or right to left.
  `mergerRegistry` - the merger registry to query to get the appropriate mergers for each difference to be merged.
Returns:
  the created command.
Since:
  3.0
See Also:
  `org.eclipse.emf.compare.domain.ICompareEditingDomain#createCopyCommand(org.eclipse.emf.compare.Diff, boolean, org.eclipse.emf.compare.merge.IMerger.Registry)`

#### createCopyCommand

    public ICompareCopyCommand createCopyCommand​(List<? extends Diff> differences,
                                                 boolean leftToRight,
                                                 IMerger.Registry mergerRegistry,
                                                 IMergeRunnable runnable)

Creates a new command that will execute the given `IMergeRunnable` that is expected to merge the given differences in from right to left or left to right by using the mergers defined in the given merger registry.

Specified by:
  `createCopyCommand` in interface `ICompareEditingDomain`
Parameters:
  `differences` - the differences to merge.
  `leftToRight` - whether the merge has to be merge from left to right or right to left.
  `mergerRegistry` - the merger registry to query to get the appropriate mergers for each difference to be merged.
  `runnable` - the runnable that will implement the merge
Returns:
  the created command.
See Also:
  `ICompareEditingDomain.createCopyCommand(java.util.List, boolean, org.eclipse.emf.compare.merge.IMerger.Registry, org.eclipse.emf.compare.command.ICompareCopyCommand.IMergeRunnable)`

#### createCopyAllNonConflictingCommand

    public ICompareCopyCommand createCopyAllNonConflictingCommand​(Comparison comparison,
                                                                  boolean leftToRight,
                                                                  IMerger.Registry mergerRegistry,
                                                                  IMergeAllNonConflictingRunnable runnable)

Creates a command that will merge all non-conflicting differences in the given direction.

A "non-conflicting" difference is any difference that is not in a real conflict with another and that does not, directly or indirectly, depend on the merge of a difference that is in conflict itself.

Note that only the differences originating from the "source" side of the chosen merge direction will be considered.

Parameters:
  `comparison` - The comparison which differences to merge.
  `leftToRight` - The direction in which we should merge the differences.
  `mergerRegistry` - The registry to query for specific mergers for each difference.
  `runnable` - the runnable to execute for the actual merge operation.
Returns:
  The copy command, ready for use.
Since:
  4.1

#### getChangeRecorder

    public ChangeRecorder getChangeRecorder()

Returns the associated `ChangeRecorder`.

Specified by:
  `getChangeRecorder` in interface `ICompareEditingDomain`
Returns:
  the associated `ChangeRecorder`.
See Also:
  `ICompareEditingDomain.getChangeRecorder()`