org.eclipse.emf.ecp.diffmerge.internal.context
Class DiffMergeModelContextImpl

java.lang.Object
  extended by org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl
      extended by org.eclipse.emf.ecp.diffmerge.internal.context.DiffMergeModelContextImpl
All Implemented Interfaces:
DiffMergeModelContext, ViewModelContext

public class DiffMergeModelContextImpl
extends ViewModelContextImpl
implements DiffMergeModelContext

Implementation of the DiffMergeModelContext based on the ViewModelContextImpl. As the ViewModelContextImpl is internal we suppress the restriction.

Author:
Eugen Neufeld

Constructor Summary
DiffMergeModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject, org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right)
          Constructor for the DiffMergeModelContextImpl.
DiffMergeModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject, org.eclipse.emf.ecore.EObject left, org.eclipse.emf.ecore.EObject right, Set<VDomainModelReference> mergedReferences)
          Constructor for the DiffMergeModelContextImpl.
DiffMergeModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject, org.eclipse.emf.ecore.EObject origin1, org.eclipse.emf.ecore.EObject origin2, Set<VDomainModelReference> mergedReferences, ViewModelService... modelServices)
          Constructor for the DiffMergeModelContextImpl.
DiffMergeModelContextImpl(VElement view, org.eclipse.emf.ecore.EObject domainObject, org.eclipse.emf.ecore.EObject origin1, org.eclipse.emf.ecore.EObject origin2, ViewModelService... modelServices)
          Constructor for the DiffMergeModelContextImpl.
 
Method Summary
 VControl getControl(int diffIndex)
          Returns the control based on the diff index.
 int getIndexOf(VControl control)
          Returns the diff index of a control.
 org.eclipse.emf.ecore.EObject getLeftModel()
          Gets the left model.
 Set<VDomainModelReference> getMergedDomainObjects()
          Returns the set of domainModelReferences which are merged.
 ControlPair getPairWithDiff(VControl control)
          Returns a pair containing the left and right control for the diff.
 org.eclipse.emf.ecore.EObject getRightModel()
          Gets the right model.
 int getTotalNumberOfDiffs()
          Returns the total number of differences.
 boolean hasDiff(VControl control)
          Checks whether a control has a diff.
 boolean isControlMerged(VControl vControl)
          Returns true if the control already was merged or doesn't have a difference at all.
 void markControl(VControl vControl, boolean merged)
          Mark a control as merged.
 
Methods inherited from class org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl
addContextUser, dispose, getChildContext, getContextValue, getControlsFor, getControlsFor, getDomainModel, getService, getViewModel, hasService, putContextValue, registerDisposeListener, registerDomainChangeListener, registerViewChangeListener, removeContextUser, unregisterDomainChangeListener, unregisterViewChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.ecp.view.spi.context.ViewModelContext
addContextUser, dispose, getChildContext, getContextValue, getControlsFor, getControlsFor, getDomainModel, getService, getViewModel, hasService, putContextValue, registerDisposeListener, registerDomainChangeListener, registerViewChangeListener, removeContextUser, unregisterDomainChangeListener, unregisterViewChangeListener
 

Constructor Detail

DiffMergeModelContextImpl

public DiffMergeModelContextImpl(VElement view,
                                 org.eclipse.emf.ecore.EObject domainObject,
                                 org.eclipse.emf.ecore.EObject left,
                                 org.eclipse.emf.ecore.EObject right)
Constructor for the DiffMergeModelContextImpl.

Parameters:
view - the VElement
domainObject - the EObject which is editable
left - the first object
right - the second object
See Also:
ViewModelContextImpl.ViewModelContextImpl(VElement, EObject)

DiffMergeModelContextImpl

public DiffMergeModelContextImpl(VElement view,
                                 org.eclipse.emf.ecore.EObject domainObject,
                                 org.eclipse.emf.ecore.EObject left,
                                 org.eclipse.emf.ecore.EObject right,
                                 Set<VDomainModelReference> mergedReferences)
Constructor for the DiffMergeModelContextImpl.

Parameters:
view - the VElement
domainObject - the EObject which is editable
left - the first object
right - the second object
mergedReferences - the set of already merged domain references
See Also:
ViewModelContextImpl.ViewModelContextImpl(VElement, EObject)

DiffMergeModelContextImpl

public DiffMergeModelContextImpl(VElement view,
                                 org.eclipse.emf.ecore.EObject domainObject,
                                 org.eclipse.emf.ecore.EObject origin1,
                                 org.eclipse.emf.ecore.EObject origin2,
                                 ViewModelService... modelServices)
Constructor for the DiffMergeModelContextImpl.

Parameters:
view - the VElement
domainObject - the EObject which is editable
origin1 - the first object
origin2 - the second object
modelServices - the ViewModelServices to register
See Also:
ViewModelContextImpl.ViewModelContextImpl(VElement, EObject, ViewModelService...)

DiffMergeModelContextImpl

public DiffMergeModelContextImpl(VElement view,
                                 org.eclipse.emf.ecore.EObject domainObject,
                                 org.eclipse.emf.ecore.EObject origin1,
                                 org.eclipse.emf.ecore.EObject origin2,
                                 Set<VDomainModelReference> mergedReferences,
                                 ViewModelService... modelServices)
Constructor for the DiffMergeModelContextImpl.

Parameters:
view - the VElement
domainObject - the EObject which is editable
origin1 - the first object
origin2 - the second object
mergedReferences - the set of already merged domain references
modelServices - the ViewModelServices to register
See Also:
ViewModelContextImpl.ViewModelContextImpl(VElement, EObject, ViewModelService...)
Method Detail

getLeftModel

public org.eclipse.emf.ecore.EObject getLeftModel()
Gets the left model.

Specified by:
getLeftModel in interface DiffMergeModelContext
Returns:
the left model

getRightModel

public org.eclipse.emf.ecore.EObject getRightModel()
Gets the right model.

Specified by:
getRightModel in interface DiffMergeModelContext
Returns:
the right model

hasDiff

public boolean hasDiff(VControl control)
Checks whether a control has a diff.

Specified by:
hasDiff in interface DiffMergeModelContext
Parameters:
control - the VControl to check
Returns:
true if there is a difference
See Also:
DiffMergeModelContext.hasDiff(org.eclipse.emf.ecp.view.spi.model.VControl)

getPairWithDiff

public ControlPair getPairWithDiff(VControl control)
Returns a pair containing the left and right control for the diff.

Specified by:
getPairWithDiff in interface DiffMergeModelContext
Parameters:
control - the control to get the pair for
Returns:
a pair or null if no diff exists for the provided control
See Also:
DiffMergeModelContext.getPairWithDiff(org.eclipse.emf.ecp.view.spi.model.VControl)

getTotalNumberOfDiffs

public int getTotalNumberOfDiffs()
Returns the total number of differences.

Specified by:
getTotalNumberOfDiffs in interface DiffMergeModelContext
Returns:
the total number of differences
See Also:
DiffMergeModelContext.getTotalNumberOfDiffs()

getIndexOf

public int getIndexOf(VControl control)
Returns the diff index of a control. If the control does not have a diff the index will be -1.

Specified by:
getIndexOf in interface DiffMergeModelContext
Parameters:
control - the VControl to get the index for
Returns:
the index of the control
See Also:
DiffMergeModelContext.getIndexOf(org.eclipse.emf.ecp.view.spi.model.VControl)

getControl

public VControl getControl(int diffIndex)
                    throws IllegalArgumentException
Returns the control based on the diff index. If the index is less then 0 and greater or equals the total number of diff, then a IllegalArgumentException will be thrown.

Specified by:
getControl in interface DiffMergeModelContext
Parameters:
diffIndex - the diff index to get the control for
Returns:
the VControl
Throws:
IllegalArgumentException - thrown if the index is invalid
See Also:
DiffMergeModelContext.getControl(int)

isControlMerged

public boolean isControlMerged(VControl vControl)
Returns true if the control already was merged or doesn't have a difference at all.

Specified by:
isControlMerged in interface DiffMergeModelContext
Parameters:
vControl - the VControl to check
Returns:
true if is merged
See Also:
DiffMergeModelContext.isControlMerged(org.eclipse.emf.ecp.view.spi.model.VControl)

markControl

public void markControl(VControl vControl,
                        boolean merged)
Mark a control as merged.

Specified by:
markControl in interface DiffMergeModelContext
Parameters:
vControl - the VControl to be merged
merged - true if control is merged, false otherwise
See Also:
DiffMergeModelContext.markControl(org.eclipse.emf.ecp.view.spi.model.VControl, boolean)

getMergedDomainObjects

public Set<VDomainModelReference> getMergedDomainObjects()
Returns the set of domainModelReferences which are merged.

Specified by:
getMergedDomainObjects in interface DiffMergeModelContext
Returns:
the set of merged VDomainModelReferences
See Also:
DiffMergeModelContext.getMergedDomainObjects()


Copyright © 2015. All Rights Reserved.