org.eclipse.emf.compare.diff.merge.service
Class MergeService

java.lang.Object
  extended by org.eclipse.emf.compare.diff.merge.service.MergeService

public final class MergeService
extends java.lang.Object

Service for use with diff merging operations.


Method Summary
static void addMergeListener(IMergeListener listener)
          Registers a new merge listener for notifications about merge operations.
protected static void doMerge(DiffElement element, boolean leftToRight)
          Applies the changes implied by a given DiffElement in the direction specified by leftToRight.
protected static void fireMergeDiffEnd(DiffElement diff)
          Notifies all registered listeners that a DiffElement has just been merged.
protected static void fireMergeDiffStart(DiffElement diff)
          Notifies all registered listeners that a DiffElement is about to be merged.
protected static void fireMergeOperationEnd(DiffElement diff)
          Notifies all registered listeners that a merge operation on a single diff just ended.
protected static void fireMergeOperationEnd(java.util.List<DiffElement> diffs)
          Notifies all registered listeners that a merge operation has ended for a list of differences.
protected static void fireMergeOperationStart(DiffElement diff)
          Notifies all registered listeners that a merge operation is about to start for a single diff.
protected static void fireMergeOperationStart(java.util.List<DiffElement> diffs)
          Notifies all registered listeners that a merge operation is about to start for a list of differences.
static EMFCompareEObjectCopier getCopier(DiffElement diff)
          Returns the copier given the diff it should merge.
static void merge(DiffElement element, boolean leftToRight)
          Merges a single DiffElement in the direction specified by leftToRight.
static void merge(java.util.List<DiffElement> elements, boolean leftToRight)
          Merges a list of DiffElements in the direction specified by leftToRight.
static void removeMergeListener(IMergeListener listener)
          removes a merge listener from the list of registered listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addMergeListener

public static void addMergeListener(IMergeListener listener)
Registers a new merge listener for notifications about merge operations. Has no effect if the listener is already registered.

Parameters:
listener - New Listener to register for notifications.

getCopier

public static EMFCompareEObjectCopier getCopier(DiffElement diff)
Returns the copier given the diff it should merge.

Parameters:
diff - The DiffElement for which a copier is needed.
Returns:
The copier for a given diff.

merge

public static void merge(DiffElement element,
                         boolean leftToRight)
Merges a single DiffElement in the direction specified by leftToRight.

Will notify the list of its merge listeners before, and after the operation.

Parameters:
element - DiffElement containing the information to merge.
leftToRight - True if the changes must be applied from the left to the right model, False when they have to be applied the other way around.

merge

public static void merge(java.util.List<DiffElement> elements,
                         boolean leftToRight)
Merges a list of DiffElements in the direction specified by leftToRight.

Will notify the list of its merge listeners before, and after the operation.

Parameters:
elements - DiffElements containing the information to merge.
leftToRight - True if the changes must be applied from the left to the right model, False when they have to be applied the other way around.

removeMergeListener

public static void removeMergeListener(IMergeListener listener)
removes a merge listener from the list of registered listeners. This will have no effect if the given listener is not registered for notifications on this service.

Parameters:
listener - New Listener to register for notifications.

doMerge

protected static void doMerge(DiffElement element,
                              boolean leftToRight)
Applies the changes implied by a given DiffElement in the direction specified by leftToRight.

Will notify the list of its merge listeners before, and after the merge.

Parameters:
element - DiffElement containing the information to merge.
leftToRight - True if the changes must be applied from the left to the right model, False when they have to be applied the other way around.

fireMergeDiffEnd

protected static void fireMergeDiffEnd(DiffElement diff)
Notifies all registered listeners that a DiffElement has just been merged.

Parameters:
diff - DiffElement which has just been merged.

fireMergeDiffStart

protected static void fireMergeDiffStart(DiffElement diff)
Notifies all registered listeners that a DiffElement is about to be merged.

Parameters:
diff - DiffElement which is about to be merged.

fireMergeOperationEnd

protected static void fireMergeOperationEnd(DiffElement diff)
Notifies all registered listeners that a merge operation on a single diff just ended.

Parameters:
diff - DiffElement which has just been merged.

fireMergeOperationEnd

protected static void fireMergeOperationEnd(java.util.List<DiffElement> diffs)
Notifies all registered listeners that a merge operation has ended for a list of differences.

Parameters:
diffs - DiffElements which have been merged.

fireMergeOperationStart

protected static void fireMergeOperationStart(DiffElement diff)
Notifies all registered listeners that a merge operation is about to start for a single diff.

Parameters:
diff - DiffElement which is about to be merged.

fireMergeOperationStart

protected static void fireMergeOperationStart(java.util.List<DiffElement> diffs)
Notifies all registered listeners that a merge operation is about to start for a list of differences.

Parameters:
diffs - DiffElements which are about to be merged.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.