Class AbstractEmfBasedComparisonParticipant
- java.lang.Object
-
- com._1c.g5.v8.dt.compare.participant.AbstractEmfBasedComparisonParticipant
-
- All Implemented Interfaces:
IComparisonParticipant
- Direct Known Subclasses:
AbstractMdAwareComparisonParticipant
public abstract class AbstractEmfBasedComparisonParticipant extends Object implements IComparisonParticipant
An abstract participant for comparison of EMF-based objects with Model core support.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractEmfBasedComparisonParticipant.BmIdsWrapper
Wrapper to store bm ids of child nodes to be compared later in a separate thread.protected static class
AbstractEmfBasedComparisonParticipant.EObjectClassFeatures
-
Field Summary
Fields Modifier and Type Field Description protected static boolean
LOG_TYPES
protected IPictureManager
pictureManager
protected IProjectFileSystemSupportProvider
projectFileSystemSupportProvider
protected IQualifiedNameFilePathConverter
qualifiedNameFilePathConverter
protected org.eclipse.xtext.scoping.IScopeProvider
scopeProvider
protected ITopObjectFqnGenerator
topObjectFqnGenerator
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEmfBasedComparisonParticipant()
Creates new participant instance with default comparison nodes factory.protected
AbstractEmfBasedComparisonParticipant(ComparisonNodeFactory nodeFactory)
Creates new participant instance with specific comparison nodes factory.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.emf.ecore.EObject
adaptOtherReference(MergeContext context, org.eclipse.emf.ecore.EObject otherObject, org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject otherValue, org.eclipse.emf.ecore.EObject mainObject)
protected org.eclipse.emf.ecore.EClass
adoptEClassToImport(org.eclipse.emf.ecore.EClass otherEClass, IComparisonSession session)
Converts, if possible, the other sideEClass
into a main supported by the main side to import object.org.eclipse.emf.ecore.EStructuralFeature
adoptMainSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature, IComparisonSession session)
Converts, if possible, the main side feature into a other supported by the other side object.protected boolean
areDifferentEClassObjectsMergeable(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, ComparisonContext comparisonContext)
protected static void
assertEClassesMatch(org.eclipse.emf.ecore.EObject object1, org.eclipse.emf.ecore.EObject object2)
Asserts whether the two specifiedEObject
s have identicalEClass
es.protected ComparisonFlags
calculateCompareValueFlags(AbstractComparedEmfObjects<?> comparingObject, ComparedObjects<Object> values, ComparedFeatures<?> comparedFeatures, ComparisonContext comparisonContext)
protected void
checkForOneSideConflict(IComparisonSession session, IComparedObjects<? extends org.eclipse.emf.ecore.EObject> comparingObject, ComparisonFlags flags)
void
clear()
Clears the participant caches.protected ComparisonFlags
compareEmfContainment(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext)
Compares containment feature.protected ComparisonFlags
compareEmfObject(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext)
protected ComparisonFlags
compareOneSideObject(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext)
Compares one-side object's triple.protected ComparisonFlags
comparePictureResource(AbstractComparedEmfObjects<?> comparingObject, ComparisonContext comparisonContext)
Compares picture resource for comparedPictureDef
's.protected ComparisonFlags
compareReference(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, ComparisonContext comparisonContext)
Compares a non-containment reference feature.protected ComparisonFlags
compareValue(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> parentNodeProvider, AbstractComparedEmfObjects<?> parentComparedObjects, ComparedFeatures<?> comparedFeatures, ComparisonContext comparisonContext)
protected AbstractEmfBasedComparisonParticipant.EObjectClassFeatures
createClassFeaturesInstance()
Creates new instance ofAbstractEmfBasedComparisonParticipant.EObjectClassFeatures
class.protected abstract org.eclipse.emf.ecore.EObject
createImportedEObject(org.eclipse.emf.ecore.EObject otherObject, IMergeSession mergeSession)
protected void
createResourceForImportedObject(org.eclipse.emf.ecore.resource.Resource.Factory resourceFactory, org.eclipse.emf.ecore.EObject originalObject, org.eclipse.emf.ecore.EObject importedObject, MergeContext context)
Creates resource using given factory for given imported object.protected void
deletePictureResourceFile(PictureDef mainPicture, IMergeSession session)
Deletes the main picture resource file.protected <T extends FeatureComparisonNode>
TfindChildNodeByFeature(IComparisonSession session, ComparisonNode parent, org.eclipse.emf.ecore.EStructuralFeature feature)
protected ContainmentComparisonNode
findChildNodeByMatchedId(IComparisonSession session, ComparisonNode parent, MatchedEmfObjects matched)
protected AbstractEmfBasedComparisonParticipant.EObjectClassFeatures
getClassFeatures(AbstractComparedEmfObjects<?> comparingObject, IComparisonSession session, boolean alwaysRecalculate)
Returns lists of features of the given EObjects being compared.protected AbstractEmfBasedComparisonParticipant.EObjectClassFeatures
getClassFeatures(org.eclipse.emf.ecore.EObject object, IComparisonSession session)
Returns lists of features of the given EObject.protected IEmfObjectMatcher
getCustomMatcher(TopComparisonNode topNode, org.eclipse.emf.ecore.EReference reference, ComparisonContext comparisonContext)
Returns a custom matcher for the specified reference.protected abstract String
getExternalPropertyQualifyingType(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference externalProperty)
Returns the EClass of the specified external property of the specified EObject.protected abstract String
getExternalPropertySymlink(TopComparisonNode node, org.eclipse.emf.ecore.EReference externalProperty, ComparisonSide side, org.eclipse.emf.ecore.EObject eObject)
Returns the symbolic link (FQN) of the specified external property.protected List<org.eclipse.emf.ecore.EReference>
getFeaturesToCompareForOneSideObject(AbstractComparedEmfObjects<?> comparingObjects)
Returns list of features to be always compared for one-side nodes.protected String
getFeatureTypeDescription(org.eclipse.emf.ecore.EStructuralFeature feature)
Map<String,IBmObject>
getForcedDDRebuildScope(TopComparisonNode topNode, MergeContext context)
In case if the merge process changes the top object it should supply information about affected DDs.protected List<String>
getMultiReferenceSymlinks(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, IComparisonSession session, ComparisonSide side)
Returns list of symbolic links for objects referenced by the specified multi-reference feature from the specified context object.protected String
getMultiReferenceValueSymlink(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject targetObject, IComparisonSession session, ComparisonSide side)
Returns symbolic link of the specified target object lying into collection of referencing objects specified by the given multi-reference feature.protected ComparisonNodeFactory
getNodeFactory()
Gets factory to create new comparison nodes.protected org.eclipse.emf.ecore.EStructuralFeature
getOtherSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature, IComparisonSession session)
Converts, if possible, the main side feature into a other supported by the other side object.protected Path
getPictureResourcePath(PictureDef picture, IComparisonDataSource dataSource)
Returns the picture resource path for the given data source.List<PotentialMergeProblemDescription>
getPotentialMergeProblemsDescriptions(ComparisonNode node, ComparisonContext comparisonContext)
Returns human-readable descriptions of potential merge problems if the the specified node is merged.protected static org.eclipse.xtext.naming.QualifiedName
getQualifiedName(String symlink)
Splits the given symlink into segments and returns them as aQualifiedName
.protected String
getSingleReferenceSymlink(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, IComparisonSession session, ComparisonSide side)
Returns a symbolic link for an object defined by a single reference from the given context object.protected ComparisonNode
getTopNode(ComparisonNode node)
protected boolean
hasConflictChangesInCollection(ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, Collection<? extends MatchedEmfObjects> matchedElements)
Tells whether the collection being compared should be treated as containing conflicts.protected org.eclipse.emf.ecore.EObject
importEmfObject(MergeContext context, ComparisonNode mergingNode, org.eclipse.emf.ecore.EObject otherObject)
protected void
importPictureResourceFile(PictureDef picture, MergeContext context)
Creates aIPostponedFileOperation
to import the other side picture resource.protected boolean
isBmIdMayChangeOnMerge(IBmObject bmObject)
Tells whether bmId of an object may change during the merge phase.boolean
isCandidateForPotentialMergeProblems(ComparisonNode node, IComparisonSession session)
Tells whether the given node may break the configuration if it is merged.boolean
isExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session)
Checks whether the feature must be excluded from the comparison.protected abstract boolean
isFeatureWithCustomMerge(org.eclipse.emf.ecore.EStructuralFeature feature)
protected boolean
isUnmatchableContainment(org.eclipse.emf.ecore.EReference reference)
Checks whether the specified containment feature cannot be matched by an identity-based matcher.protected Collection<MatchedEmfObjects>
matchEmfObjects(TopComparisonNode topNode, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, ComparisonContext comparisonContext, ComparisonFlags parentFlags)
protected void
mergeEmfProperties(MergeContext context, ComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects)
protected void
mergeEmfReference(MergeContext context, ReferenceFeatureComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences)
protected void
mergeOtherContainment(MergeContext context, ContainmentFeatureComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences)
ExternalMergeToolResult
mergeUsingExternalTool(ComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
Merges nodes using an external tool that are supported by this participant.protected static boolean
needCreateOneSideNode(AbstractComparedEmfObjects<?> comparedObjects, ComparisonFlags nodeFlags, boolean threeWay)
Checks whether we need to create one-side node for the compared objects.void
onChildrenMerged(TopComparisonNode topNode, MergeContext context)
Called when the child nodes of the specified top node have been merged.List<IRenameOnMergeOperation>
prepareRenameOperations(IMergeSession mergeSession, ComparisonContext context)
Gets a list of rename operations prepared by this participant.protected void
removeObjectFromContainerOnMerge(MergeContext context, org.eclipse.emf.ecore.EObject mainContainer, org.eclipse.emf.ecore.EReference mainReference, org.eclipse.emf.ecore.EObject mainObject)
Removes the given object from the container on the MAIN side during the merge phase.protected void
removeObjectFromListOnMerge(MergeContext context, org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> mainList, org.eclipse.emf.ecore.EObject mainObject)
Removes the given object from the given list on the MAIN side during the merge phase.void
restoreCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Restores custom settings for the specified node from the given merge settings container.void
saveCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Saves custom settings for the specified node into the given merge settings container.protected void
setObjectToContainerOnMerge(MergeContext context, ComparisonNode mergingNode, org.eclipse.emf.ecore.EObject mainContainer, org.eclipse.emf.ecore.EReference mainReference, org.eclipse.emf.ecore.EObject eObject)
Sets the object to the given container on the MAIN side.boolean
supportsCustomMerging(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports custom merging.boolean
supportsMergingUsingExternalTool(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports merging using external tool.boolean
supportsPrioritizedMerging(ComparisonNode node, IComparisonSession session)
Tells whether the given node supports prioritized merging.protected void
translateReferencesInImportedObject(org.eclipse.emf.ecore.EObject eObject, MergeContext mergeContext)
protected void
updatePictureResourceFile(PictureDef mainPicture, PictureDef otherPicture, IMergeSession session)
Updates the main picture resource file with the other picture resource.protected org.eclipse.emf.ecore.EObject
wrapOtherReference(MergeContext context, org.eclipse.emf.ecore.EObject otherObject, org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject otherValue)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com._1c.g5.v8.dt.compare.core.IComparisonParticipant
ableToBreakCorrespondence, addNewTopObjectToComparison, adoptExternalProperty, breakCorrespondence, breakMainSideCorrespondence, combineOneSideNodes, compare, createMergeContext, getDefaultMergeRule, getDefaultMustBeMerged, getModelPackage, getPotentialCorrespondingNodes, merge, retrieveComparedObjects, supports, updateComparison, validateMerge
-
-
-
-
Field Detail
-
scopeProvider
protected org.eclipse.xtext.scoping.IScopeProvider scopeProvider
-
LOG_TYPES
protected static final boolean LOG_TYPES
- See Also:
- Constant Field Values
-
topObjectFqnGenerator
@Inject protected ITopObjectFqnGenerator topObjectFqnGenerator
-
qualifiedNameFilePathConverter
@Inject protected IQualifiedNameFilePathConverter qualifiedNameFilePathConverter
-
pictureManager
@Inject protected IPictureManager pictureManager
-
projectFileSystemSupportProvider
@Inject protected IProjectFileSystemSupportProvider projectFileSystemSupportProvider
-
-
Constructor Detail
-
AbstractEmfBasedComparisonParticipant
protected AbstractEmfBasedComparisonParticipant()
Creates new participant instance with default comparison nodes factory.
-
AbstractEmfBasedComparisonParticipant
protected AbstractEmfBasedComparisonParticipant(ComparisonNodeFactory nodeFactory)
Creates new participant instance with specific comparison nodes factory.- Parameters:
nodeFactory
- the node factory to use, cannot benull
-
-
Method Detail
-
prepareRenameOperations
public List<IRenameOnMergeOperation> prepareRenameOperations(IMergeSession mergeSession, ComparisonContext context)
Description copied from interface:IComparisonParticipant
Gets a list of rename operations prepared by this participant.- Specified by:
prepareRenameOperations
in interfaceIComparisonParticipant
- Parameters:
mergeSession
- the merge session, notnull
context
- the comparison context, notnull
- Returns:
- the list of rename operations, never
null
-
clear
public void clear()
Description copied from interface:IComparisonParticipant
Clears the participant caches.- Specified by:
clear
in interfaceIComparisonParticipant
-
supportsPrioritizedMerging
public boolean supportsPrioritizedMerging(ComparisonNode node, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Tells whether the given node supports prioritized merging.- Specified by:
supportsPrioritizedMerging
in interfaceIComparisonParticipant
- Parameters:
node
- the node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node supports prioritized merging,false
otherwise
-
supportsCustomMerging
public boolean supportsCustomMerging(ComparisonNode node, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Tells whether the given node supports custom merging.- Specified by:
supportsCustomMerging
in interfaceIComparisonParticipant
- Parameters:
node
- the node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node supports custom merging,false
otherwise
-
supportsMergingUsingExternalTool
public boolean supportsMergingUsingExternalTool(ComparisonNode node, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Tells whether the given node supports merging using external tool.- Specified by:
supportsMergingUsingExternalTool
in interfaceIComparisonParticipant
- Parameters:
node
- the comparison node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node supports merging using external tool,false
otherwise
-
isExcludedFromComparison
public boolean isExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Checks whether the feature must be excluded from the comparison.- Specified by:
isExcludedFromComparison
in interfaceIComparisonParticipant
- Parameters:
feature
- the feature to check, cannot benull
comparedContextObjects
- the triple of compared objects, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the feature must be excluded,false
otherwise
-
onChildrenMerged
public void onChildrenMerged(TopComparisonNode topNode, MergeContext context)
Description copied from interface:IComparisonParticipant
Called when the child nodes of the specified top node have been merged.- Specified by:
onChildrenMerged
in interfaceIComparisonParticipant
- Parameters:
topNode
- the top node, notnull
context
- Current merge operation context, notnull
-
getForcedDDRebuildScope
public Map<String,IBmObject> getForcedDDRebuildScope(TopComparisonNode topNode, MergeContext context)
Description copied from interface:IComparisonParticipant
In case if the merge process changes the top object it should supply information about affected DDs.- Specified by:
getForcedDDRebuildScope
in interfaceIComparisonParticipant
- Parameters:
topNode
- The top node of the comparison model representing the merged object, notnull
context
- Current merge operation context, notnull
- Returns:
- The map of the affected DD segments and corresponding objects, may be empty, never
null
-
adoptMainSideFeature
public org.eclipse.emf.ecore.EStructuralFeature adoptMainSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Converts, if possible, the main side feature into a other supported by the other side object.- Specified by:
adoptMainSideFeature
in interfaceIComparisonParticipant
- Parameters:
mainSideFeature
- the main side feature to convert, cannot benull
session
- the comparison session, cannot benull
- Returns:
- the converted feature applicable for other side object or
null
-
saveCustomSettings
public void saveCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Saves custom settings for the specified node into the given merge settings container. Does nothing if the node doesn't have any custom settings.- Specified by:
saveCustomSettings
in interfaceIComparisonParticipant
- Parameters:
node
- the comparison node to save custom settings for, cannot benull
container
- the container of serializable settings, cannot benull
session
- the comparison session, cannot benull
-
restoreCustomSettings
public void restoreCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Restores custom settings for the specified node from the given merge settings container.- Specified by:
restoreCustomSettings
in interfaceIComparisonParticipant
- Parameters:
node
- the comparison node to restore custom settings for, cannot benull
container
- the container of serializable settings, cannot benull
session
- the comparison session, cannot benull
-
isCandidateForPotentialMergeProblems
public boolean isCandidateForPotentialMergeProblems(ComparisonNode node, IComparisonSession session)
Description copied from interface:IComparisonParticipant
Tells whether the given node may break the configuration if it is merged.- Specified by:
isCandidateForPotentialMergeProblems
in interfaceIComparisonParticipant
- Parameters:
node
- the node to check, cannot benull
session
- the comparison session, cannot benull
- Returns:
true
if the node may break the configuration,false
otherwise
-
getPotentialMergeProblemsDescriptions
public List<PotentialMergeProblemDescription> getPotentialMergeProblemsDescriptions(ComparisonNode node, ComparisonContext comparisonContext)
Description copied from interface:IComparisonParticipant
Returns human-readable descriptions of potential merge problems if the the specified node is merged.- Specified by:
getPotentialMergeProblemsDescriptions
in interfaceIComparisonParticipant
- Parameters:
node
- the node to get merge problems descriptions for, cannot benull
comparisonContext
- the comparison context, cannot benull
- Returns:
- the list of descriptions, never
null
, can be empty if the node doesn't bring any merge problems
-
mergeUsingExternalTool
public ExternalMergeToolResult mergeUsingExternalTool(ComparisonNode node, ComparisonContext comparisonContext, org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface:IComparisonParticipant
Merges nodes using an external tool that are supported by this participant.- Specified by:
mergeUsingExternalTool
in interfaceIComparisonParticipant
- Parameters:
node
- the comparison node, cannot benull
comparisonContext
- the comparison context, cannot benull
monitor
- the progress monitor, cannot benull
- Returns:
- the external merge tool result or
null
if no nodes were merged
-
createResourceForImportedObject
protected void createResourceForImportedObject(org.eclipse.emf.ecore.resource.Resource.Factory resourceFactory, org.eclipse.emf.ecore.EObject originalObject, org.eclipse.emf.ecore.EObject importedObject, MergeContext context)
Creates resource using given factory for given imported object.- Parameters:
resourceFactory
- the factory, cannot benull
originalObject
- the original object, cannot benull
importedObject
- the imported object, cannot benull
the
- current merge context, cannot benull
-
createClassFeaturesInstance
protected AbstractEmfBasedComparisonParticipant.EObjectClassFeatures createClassFeaturesInstance()
Creates new instance ofAbstractEmfBasedComparisonParticipant.EObjectClassFeatures
class. Override in descendants if the class is to be extended.- Returns:
- the instance of
AbstractEmfBasedComparisonParticipant.EObjectClassFeatures
class, nevernull
-
getClassFeatures
protected AbstractEmfBasedComparisonParticipant.EObjectClassFeatures getClassFeatures(org.eclipse.emf.ecore.EObject object, IComparisonSession session)
Returns lists of features of the given EObject.- Parameters:
object
- the object to get class features for, cannot benull
session
- the comparison session, cannot benull
- Returns:
- the filled
AbstractEmfBasedComparisonParticipant.EObjectClassFeatures
instance, nevernull
-
getClassFeatures
protected AbstractEmfBasedComparisonParticipant.EObjectClassFeatures getClassFeatures(AbstractComparedEmfObjects<?> comparingObject, IComparisonSession session, boolean alwaysRecalculate)
Returns lists of features of the given EObjects being compared.- Parameters:
comparingObject
- the comparing object, cannot benull
session
- the comparison session, cannot benull
alwaysRecalculate
- tells whether EObject class features should be always recalculated- Returns:
- the filled
AbstractEmfBasedComparisonParticipant.EObjectClassFeatures
instance, nevernull
-
getFeatureTypeDescription
protected String getFeatureTypeDescription(org.eclipse.emf.ecore.EStructuralFeature feature)
-
compareValue
protected ComparisonFlags compareValue(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> parentNodeProvider, AbstractComparedEmfObjects<?> parentComparedObjects, ComparedFeatures<?> comparedFeatures, ComparisonContext comparisonContext)
-
calculateCompareValueFlags
protected ComparisonFlags calculateCompareValueFlags(AbstractComparedEmfObjects<?> comparingObject, ComparedObjects<Object> values, ComparedFeatures<?> comparedFeatures, ComparisonContext comparisonContext)
-
compareReference
protected ComparisonFlags compareReference(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, ComparisonContext comparisonContext)
Compares a non-containment reference feature.- Parameters:
topParent
- the top parent node, cannot benull
nodeProvider
- the provider of the node hosting the compared EObject, cannot benull
comparingObject
- the triple of parent objects containing the given feature, cannot benull
comparedReferences
- the triple of reference features to be compared, cannot benull
comparisonContext
- the current comparison context, cannot benull
- Returns:
- the resulting flags, never
null
-
getSingleReferenceSymlink
protected String getSingleReferenceSymlink(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, IComparisonSession session, ComparisonSide side)
Returns a symbolic link for an object defined by a single reference from the given context object.- Parameters:
contextObject
- the context object owning the feature, cannot benull
reference
- the single reference feature, cannot benull
session
- the comparison session, cannot benull
side
- the comparison side where the context object lies, cannot benull
- Returns:
- symbolic link or
null
if there is no target object indentified by a symbolic name in the specified context object
-
getMultiReferenceSymlinks
protected List<String> getMultiReferenceSymlinks(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, IComparisonSession session, ComparisonSide side)
Returns list of symbolic links for objects referenced by the specified multi-reference feature from the specified context object.- Parameters:
contextObject
- the context object owning the feature, cannot benull
reference
- the multi-reference feature, cannot benull
session
- the comparison session, cannot benull
side
- the comparison side where the context object lies, cannot benull
- Returns:
- list of symbolic links, may be empty, never
null
-
getMultiReferenceValueSymlink
protected String getMultiReferenceValueSymlink(org.eclipse.emf.ecore.EObject contextObject, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject targetObject, IComparisonSession session, ComparisonSide side)
Returns symbolic link of the specified target object lying into collection of referencing objects specified by the given multi-reference feature.- Parameters:
contextObject
- the context object owning the multi-reference feature, cannot benull
reference
- the multi-reference feature, cannot benull
targetObject
- the object to get symbolic link for, cannot benull
session
- the comparison session, cannot benull
side
- the comparison side where the context object lies, cannot benull
- Returns:
- symbolic link or
null
in case the target object cannot be indentified by a symbolic name in the specified context object
-
compareEmfContainment
protected ComparisonFlags compareEmfContainment(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext)
Compares containment feature.- Parameters:
topParent
- the top parent comparison node, cannot benull
nodeProvider
- the lazy provider for the parent comparison node, cannot benull
comparingObject
- the triple of parent objects containing the specified feature, cannot benull
comparedReferences
- the containment features to be compared, cannot benull
childBmIds
- collector of indexes of child nodes to be compared later, cannot benull
comparisonContext
- the comparison context, cannot benull
- Returns:
- the resulting comparison flags, never
null
-
isUnmatchableContainment
protected boolean isUnmatchableContainment(org.eclipse.emf.ecore.EReference reference)
Checks whether the specified containment feature cannot be matched by an identity-based matcher.- Parameters:
reference
- the containment feature to check- Returns:
true
if the feature cannot be matched by an identity matcher
-
matchEmfObjects
protected Collection<MatchedEmfObjects> matchEmfObjects(TopComparisonNode topNode, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, ComparisonContext comparisonContext, ComparisonFlags parentFlags)
-
compareEmfObject
protected ComparisonFlags compareEmfObject(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext)
-
compareOneSideObject
protected ComparisonFlags compareOneSideObject(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext)
Compares one-side object's triple.- Parameters:
topParent
- the top parent node, cannot benull
nodeProvider
- the parent node provider, cannot benull
comparingObject
- the triple of objects being compared, cannot benull
childBmIds
- the wrapper of child object indices, can benull
comparisonContext
- the comparison context , cannot benull
- Returns:
- the result of comparison, never
null
-
getFeaturesToCompareForOneSideObject
protected List<org.eclipse.emf.ecore.EReference> getFeaturesToCompareForOneSideObject(AbstractComparedEmfObjects<?> comparingObjects)
Returns list of features to be always compared for one-side nodes.- Parameters:
comparingObjects
- the triple of objects being compared, cannot benull
- Returns:
- the list of feature to be compared for one-side nodes, never
null
-
getCustomMatcher
protected IEmfObjectMatcher getCustomMatcher(TopComparisonNode topNode, org.eclipse.emf.ecore.EReference reference, ComparisonContext comparisonContext)
Returns a custom matcher for the specified reference.- Parameters:
topNode
- the top nodereference
- the reference to get a custom matcher forcomparisonContext
- the current comparison context, cannot benull
- Returns:
- a custom matcher or
null
if no custom matcher can be found
-
assertEClassesMatch
protected static void assertEClassesMatch(org.eclipse.emf.ecore.EObject object1, org.eclipse.emf.ecore.EObject object2)
Asserts whether the two specifiedEObject
s have identicalEClass
es.- Parameters:
object1
- the firstEObject
object2
- the secondEObject
-
areDifferentEClassObjectsMergeable
protected boolean areDifferentEClassObjectsMergeable(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, ComparisonContext comparisonContext)
-
mergeEmfProperties
protected void mergeEmfProperties(MergeContext context, ComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects)
-
getTopNode
protected ComparisonNode getTopNode(ComparisonNode node)
-
importEmfObject
protected org.eclipse.emf.ecore.EObject importEmfObject(MergeContext context, ComparisonNode mergingNode, org.eclipse.emf.ecore.EObject otherObject)
-
findChildNodeByFeature
protected final <T extends FeatureComparisonNode> T findChildNodeByFeature(IComparisonSession session, ComparisonNode parent, org.eclipse.emf.ecore.EStructuralFeature feature)
-
findChildNodeByMatchedId
protected final ContainmentComparisonNode findChildNodeByMatchedId(IComparisonSession session, ComparisonNode parent, MatchedEmfObjects matched)
-
mergeOtherContainment
protected void mergeOtherContainment(MergeContext context, ContainmentFeatureComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences)
-
translateReferencesInImportedObject
protected void translateReferencesInImportedObject(org.eclipse.emf.ecore.EObject eObject, MergeContext mergeContext)
-
mergeEmfReference
protected void mergeEmfReference(MergeContext context, ReferenceFeatureComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences)
-
wrapOtherReference
protected org.eclipse.emf.ecore.EObject wrapOtherReference(MergeContext context, org.eclipse.emf.ecore.EObject otherObject, org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject otherValue)
-
adaptOtherReference
protected org.eclipse.emf.ecore.EObject adaptOtherReference(MergeContext context, org.eclipse.emf.ecore.EObject otherObject, org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject otherValue, org.eclipse.emf.ecore.EObject mainObject)
-
createImportedEObject
protected abstract org.eclipse.emf.ecore.EObject createImportedEObject(org.eclipse.emf.ecore.EObject otherObject, IMergeSession mergeSession)
-
isFeatureWithCustomMerge
protected abstract boolean isFeatureWithCustomMerge(org.eclipse.emf.ecore.EStructuralFeature feature)
-
getExternalPropertySymlink
protected abstract String getExternalPropertySymlink(TopComparisonNode node, org.eclipse.emf.ecore.EReference externalProperty, ComparisonSide side, org.eclipse.emf.ecore.EObject eObject)
Returns the symbolic link (FQN) of the specified external property.- Parameters:
node
- the node with the external propertyexternalProperty
- theEReference
to the external propertyside
- the comparison sideeObject
- theEObject
referencing the external property- Returns:
- the symbolic link
-
getExternalPropertyQualifyingType
protected abstract String getExternalPropertyQualifyingType(org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference externalProperty)
Returns the EClass of the specified external property of the specified EObject.- Parameters:
eObject
-externalProperty
-- Returns:
-
hasConflictChangesInCollection
protected boolean hasConflictChangesInCollection(ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, Collection<? extends MatchedEmfObjects> matchedElements)
Tells whether the collection being compared should be treated as containing conflicts.- Parameters:
comparedReferences
- the triple of many-features being compared, cannot benull
- Returns:
true
if the collection should be treated as containing conflicts,false
otherwise
-
comparePictureResource
protected ComparisonFlags comparePictureResource(AbstractComparedEmfObjects<?> comparingObject, ComparisonContext comparisonContext)
Compares picture resource for comparedPictureDef
's.- Parameters:
comparingObject
- the triple ofPictureDef
's to be compared, can not benull
comparisonContext
- the current comparison context, can not benull
- Returns:
- the resulting flags, never
null
-
importPictureResourceFile
protected void importPictureResourceFile(PictureDef picture, MergeContext context)
Creates aIPostponedFileOperation
to import the other side picture resource.- Parameters:
picture
- the other side picture to create an add operation for, can not benull
context
- the merge context, can not benull
-
updatePictureResourceFile
protected void updatePictureResourceFile(PictureDef mainPicture, PictureDef otherPicture, IMergeSession session)
Updates the main picture resource file with the other picture resource. If the other resource doesn't exist the main resource file will be deleted.- Parameters:
mainPicture
- the main side picture, can not benull
otherPicture
- the other side picture, can not benull
session
- the merge session, can not benull
-
deletePictureResourceFile
protected void deletePictureResourceFile(PictureDef mainPicture, IMergeSession session)
Deletes the main picture resource file.- Parameters:
mainPicture
- the main side picture, can not benull
session
- the merge session, can not benull
-
getPictureResourcePath
protected Path getPictureResourcePath(PictureDef picture, IComparisonDataSource dataSource)
Returns the picture resource path for the given data source. By default returnsnull
.- Parameters:
picture
- the picture to get resource path for, cannot benull
dataSource
- the comparison data source, cannot benull
- Returns:
- the picture resource path, may be
null
-
adoptEClassToImport
protected org.eclipse.emf.ecore.EClass adoptEClassToImport(org.eclipse.emf.ecore.EClass otherEClass, IComparisonSession session)
Converts, if possible, the other sideEClass
into a main supported by the main side to import object.- Parameters:
otherEClass
- the other sideEClass
to convert, cannot benull
session
- the comparison session, cannot benull
- Returns:
- the converted
EClass
, nevernull
-
getOtherSideFeature
protected org.eclipse.emf.ecore.EStructuralFeature getOtherSideFeature(org.eclipse.emf.ecore.EStructuralFeature mainSideFeature, IComparisonSession session)
Converts, if possible, the main side feature into a other supported by the other side object. Returns the given main side feature if no convert was found.- Parameters:
mainSideFeature
- the main side feature to convert, cannot benull
session
- the comparison session, cannot benull
- Returns:
- the converted feature applicable for other side object or given main side feature
if no convert was found, never
null
-
needCreateOneSideNode
protected static boolean needCreateOneSideNode(AbstractComparedEmfObjects<?> comparedObjects, ComparisonFlags nodeFlags, boolean threeWay)
Checks whether we need to create one-side node for the compared objects.- Parameters:
comparedObjects
- the compared objects to check, must have object only on MAIN or on OTHER side, cannot benull
nodeFlags
- the node flags calculated for it, cannot benull
threeWay
- is three-way merge- Returns:
true
if need to create the node in the model,false
otherwise
-
getQualifiedName
protected static org.eclipse.xtext.naming.QualifiedName getQualifiedName(String symlink)
Splits the given symlink into segments and returns them as aQualifiedName
.- Parameters:
symlink
- the given symlink, can not benull
- Returns:
- a qualified name, never
null
-
removeObjectFromListOnMerge
protected void removeObjectFromListOnMerge(MergeContext context, org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EObject> mainList, org.eclipse.emf.ecore.EObject mainObject)
Removes the given object from the given list on the MAIN side during the merge phase. Override in descendants if need customized behavior on deletion.- Parameters:
context
- the merge context, cannot benull
mainList
- the list to remove the object from, cannot benull
mainObject
- the object to be removed, cannot benull
-
removeObjectFromContainerOnMerge
protected void removeObjectFromContainerOnMerge(MergeContext context, org.eclipse.emf.ecore.EObject mainContainer, org.eclipse.emf.ecore.EReference mainReference, org.eclipse.emf.ecore.EObject mainObject)
Removes the given object from the container on the MAIN side during the merge phase. Override in descendants if need customized behavior on deletion.- Parameters:
context
- the merge context, cannot benull
mainContainer
- the container to remove from, cannot benull
mainReference
- the reference to remove object by, cannot benull
mainObject
- the object to be removed, cannot benull
-
setObjectToContainerOnMerge
protected void setObjectToContainerOnMerge(MergeContext context, ComparisonNode mergingNode, org.eclipse.emf.ecore.EObject mainContainer, org.eclipse.emf.ecore.EReference mainReference, org.eclipse.emf.ecore.EObject eObject)
Sets the object to the given container on the MAIN side.- Parameters:
context
- the merge context, cannot benull
mergingNode
- the comparison node related to the merging feature, cannot benull
mainContainer
- the container to add into, cannot benull
mainReference
- the reference to add object by, cannot benull
eObject
- the object to be added, cannot benull
-
isBmIdMayChangeOnMerge
protected boolean isBmIdMayChangeOnMerge(IBmObject bmObject)
Tells whether bmId of an object may change during the merge phase. Override in descendants for specific types.- Parameters:
bmObject
- the object to be checked, cannot benull
- Returns:
true
if bmId may change,false
otherwise
-
getNodeFactory
protected ComparisonNodeFactory getNodeFactory()
Gets factory to create new comparison nodes.- Returns:
- the comparison node factory instance, never
null
-
checkForOneSideConflict
protected void checkForOneSideConflict(IComparisonSession session, IComparedObjects<? extends org.eclipse.emf.ecore.EObject> comparingObject, ComparisonFlags flags)
-
-