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, ICompareInputDetailsProvider provider)
          Creates a CompareInput given the resulting match and diff of the comparison.
ModelCompareInput(MatchResourceSet matchResourceset, DiffResourceSet diffResourceSet)
          Creates a CompareInput given the resulting match and diff of the comparison.
ModelCompareInput(MatchResourceSet matchResourceset, DiffResourceSet diffResourceSet, ICompareInputDetailsProvider provider)
          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()
          
 org.eclipse.emf.ecore.resource.Resource getAncestorResource()
          Returns the left resource of this input.
 java.lang.Object 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()
          
 org.eclipse.emf.ecore.resource.Resource getLeftResource()
          Returns the left resource of this input.
 java.lang.Object getMatch()
          Returns this ModelCompareInput's MatchModel.
 java.lang.String getName()
          
 org.eclipse.compare.ITypedElement getRight()
          
 org.eclipse.emf.ecore.resource.Resource getRightResource()
          Returns the left resource of this input.
 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(MatchResourceSet matchResourceset,
                         DiffResourceSet diffResourceSet)
Creates a CompareInput given the resulting match and diff of the comparison.

Parameters:
matchResourceset - match of the comparison.
diffResourceSet - diff of the comparison.

ModelCompareInput

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

Parameters:
matchModel - match of the comparison.
diffModel - diff of the comparison.
provider - The input provider which has been used for this comparison.
Since:
1.1

ModelCompareInput

public ModelCompareInput(MatchResourceSet matchResourceset,
                         DiffResourceSet diffResourceSet,
                         ICompareInputDetailsProvider provider)
Creates a CompareInput given the resulting match and diff of the comparison.

Parameters:
matchResourceset - match of the comparison.
diffResourceSet - diff of the comparison.
provider - The input provider which has been used for this comparison.
Since:
1.1
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()

getAncestorResource

public org.eclipse.emf.ecore.resource.Resource getAncestorResource()
Returns the left resource of this input.

Returns:
The left loaded resource.
Since:
1.0

getDiff

public java.lang.Object 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()

getLeftResource

public org.eclipse.emf.ecore.resource.Resource getLeftResource()
Returns the left resource of this input.

Returns:
The left loaded resource.
Since:
1.0

getMatch

public java.lang.Object 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()

getRightResource

public org.eclipse.emf.ecore.resource.Resource getRightResource()
Returns the left resource of this input.

Returns:
The left loaded resource.
Since:
1.0

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.