org.eclipse.emf.compare.ui
Class ModelCompareInput

java.lang.Object
  extended by org.eclipse.emf.compare.ui.ModelCompareInput
All Implemented Interfaces:
org.eclipse.compare.structuremergeviewer.ICompareInput

public class ModelCompareInput
extends java.lang.Object
implements org.eclipse.compare.structuremergeviewer.ICompareInput

Input to be used for a 2 or 3-way comparison in a ModelContentMergeViewer.


Constructor Summary
ModelCompareInput(MatchModel matchModel, DiffModel diffModel)
          Creates a CompareInput given the resulting match and diff of the comparison.
ModelCompareInput(MatchModel matchModel, DiffModel diffModel, org.eclipse.emf.compare.ui.internal.ModelComparator comparator)
          Creates a CompareInput given the resulting match and diff of the comparison.
 
Method Summary
 void addCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener listener)
          
 void copy(boolean leftToRight)
          
 void copy(DiffElement element, boolean leftToRight)
          Copies a single DiffElement or a DiffGroup in the given direction.
 void copy(java.util.List<DiffElement> elements, boolean leftToRight)
          Copies a list of DiffElements or DiffGroups in the given direction.
protected  void doCopy(DiffElement element, boolean leftToRight)
          Applies the changes implied by a given DiffElement in the direction specified by leftToRight.
protected  void doCopy(java.util.List<DiffElement> elements, boolean leftToRight)
          Applies the changes implied by a list of DiffElement in the direction specified by leftToRight.
protected  void fireCompareInputChanged()
          Notifies all listeners registered for this input that a change occured.
 org.eclipse.compare.ITypedElement getAncestor()
          
 DiffModel getDiff()
          Returns this ModelCompareInput's DiffModel.
 java.util.List<DiffElement> getDiffAsList()
          Returns the DiffElement of the input DiffModel as a list.
 org.eclipse.swt.graphics.Image getImage()
          
 int getKind()
          
 org.eclipse.compare.ITypedElement getLeft()
          
 MatchModel getMatch()
          Returns this ModelCompareInput's MatchModel.
 java.lang.String getName()
          
 org.eclipse.compare.ITypedElement getRight()
          
 void removeCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener listener)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelCompareInput

public ModelCompareInput(MatchModel matchModel,
                         DiffModel diffModel)
Creates a CompareInput given the resulting match and diff of the comparison.

Parameters:
matchModel - match of the comparison.
diffModel - diff of the comparison.

ModelCompareInput

public ModelCompareInput(MatchModel matchModel,
                         DiffModel diffModel,
                         org.eclipse.emf.compare.ui.internal.ModelComparator comparator)
Creates a CompareInput given the resulting match and diff of the comparison.

Parameters:
matchModel - match of the comparison.
diffModel - diff of the comparison.
comparator - The comparator which has been used for this comparison.
Method Detail

addCompareInputChangeListener

public void addCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener listener)

Specified by:
addCompareInputChangeListener in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.addCompareInputChangeListener(ICompareInputChangeListener)

copy

public void copy(boolean leftToRight)

Specified by:
copy in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.copy(boolean)

copy

public void copy(DiffElement element,
                 boolean leftToRight)
Copies a single DiffElement or a DiffGroup in the given direction.

Parameters:
element - Element to copy.
leftToRight - Direction of the copy.

copy

public void copy(java.util.List<DiffElement> elements,
                 boolean leftToRight)
Copies a list of DiffElements or DiffGroups in the given direction.

Parameters:
elements - Elements to copy.
leftToRight - Direction of the copy.

getAncestor

public org.eclipse.compare.ITypedElement getAncestor()

Specified by:
getAncestor in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.getAncestor()

getDiff

public DiffModel getDiff()
Returns this ModelCompareInput's DiffModel.

Returns:
This ModelCompareInput's DiffModel.

getDiffAsList

public java.util.List<DiffElement> getDiffAsList()
Returns the DiffElement of the input DiffModel as a list. Doesn't take DiffGroups into account.

Returns:
The DiffElement of the input DiffModel as a list.

getImage

public org.eclipse.swt.graphics.Image getImage()

Specified by:
getImage in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.getImage()

getKind

public int getKind()

Specified by:
getKind in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.getKind()

getLeft

public org.eclipse.compare.ITypedElement getLeft()

Specified by:
getLeft in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.getLeft()

getMatch

public MatchModel getMatch()
Returns this ModelCompareInput's MatchModel.

Returns:
This ModelCompareInput's MatchModel.

getName

public java.lang.String getName()

Specified by:
getName in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.getName()

getRight

public org.eclipse.compare.ITypedElement getRight()

Specified by:
getRight in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.getRight()

removeCompareInputChangeListener

public void removeCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener listener)

Specified by:
removeCompareInputChangeListener in interface org.eclipse.compare.structuremergeviewer.ICompareInput
See Also:
ICompareInput.removeCompareInputChangeListener(ICompareInputChangeListener)

doCopy

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

Parameters:
element - DiffElement containing the copy information.
leftToRight - True if the changes must be applied from the left to the right model, False otherwise.

doCopy

protected void doCopy(java.util.List<DiffElement> elements,
                      boolean leftToRight)
Applies the changes implied by a list of DiffElement in the direction specified by leftToRight.

Parameters:
elements - DiffElements containing the copy information.
leftToRight - True if the changes must be applied from the left to the right model, False otherwise.

fireCompareInputChanged

protected void fireCompareInputChanged()
Notifies all listeners registered for this input that a change occured.


Copyright 2006 IBM Corporation and others.
All Rights Reserved.