Class AbstractEmfBasedComparisonParticipant
java.lang.Object
com._1c.g5.v8.dt.compare.participant.AbstractEmfBasedComparisonParticipant
- All Implemented Interfaces:
IComparisonParticipant
- Direct Known Subclasses:
AbstractMdAwareComparisonParticipant,CmiComparisonParticipant,HtmlDocumentComparisonParticipant,RightsComparisonParticipant
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 ClassesModifier and TypeClassDescriptionprotected classWrapper to store bm ids of child nodes to be compared later in a separate thread.protected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final booleanprotected IPictureManagerprotected IProjectFileSystemSupportProviderprotected IQualifiedNameFilePathConverterprotected org.eclipse.xtext.scoping.IScopeProviderprotected ITopObjectFqnGenerator -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates new participant instance with default comparison nodes factory.protectedCreates new participant instance with specific comparison nodes factory. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.emf.ecore.EObjectadaptOtherReference(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.EClassadoptEClassToImport(org.eclipse.emf.ecore.EClass otherEClass, IComparisonSession session) Converts, if possible, the other sideEClassinto a main supported by the main side to import object.org.eclipse.emf.ecore.EStructuralFeatureadoptMainSideFeature(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 booleanareDifferentEClassObjectsMergeable(org.eclipse.emf.ecore.EObject main, org.eclipse.emf.ecore.EObject other, ComparisonContext comparisonContext) protected static voidassertEClassesMatch(org.eclipse.emf.ecore.EObject object1, org.eclipse.emf.ecore.EObject object2) Asserts whether the two specifiedEObjects have identicalEClasses.protected ComparisonFlagscalculateCompareValueFlags(AbstractComparedEmfObjects<?> comparingObject, ComparedObjects<Object> values, ComparedFeatures<?> comparedFeatures, ComparisonContext comparisonContext) protected voidcheckForOneSideConflict(IComparisonSession session, IComparedObjects<? extends org.eclipse.emf.ecore.EObject> comparingObject, ComparisonFlags flags) voidclear()Clears the participant caches.protected ComparisonFlagscompareEmfContainment(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext) Compares containment feature.protected ComparisonFlagscompareEmfObject(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext) protected ComparisonFlagscompareOneSideObject(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, AbstractEmfBasedComparisonParticipant.BmIdsWrapper childBmIds, ComparisonContext comparisonContext) Compares one-side object's triple.protected ComparisonFlagscomparePictureResource(AbstractComparedEmfObjects<?> comparingObject, ComparisonContext comparisonContext) Compares picture resource for comparedPictureDef's.protected ComparisonFlagscompareReference(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> nodeProvider, AbstractComparedEmfObjects<?> comparingObject, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences, ComparisonContext comparisonContext) Compares a non-containment reference feature.protected ComparisonFlagscompareValue(TopComparisonNode topParent, LazyNodeProvider<? extends ComparisonNode> parentNodeProvider, AbstractComparedEmfObjects<?> parentComparedObjects, ComparedFeatures<?> comparedFeatures, ComparisonContext comparisonContext) Creates new instance ofAbstractEmfBasedComparisonParticipant.EObjectClassFeaturesclass.protected abstract org.eclipse.emf.ecore.EObjectcreateImportedEObject(org.eclipse.emf.ecore.EObject otherObject, IMergeSession mergeSession) protected voidcreateResourceForImportedObject(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 voiddeletePictureResourceFile(PictureDef mainPicture, IMergeSession session) Deletes the main picture resource file.protected final <T extends FeatureComparisonNode>
TfindChildNodeByFeature(IComparisonSession session, ComparisonNode parent, org.eclipse.emf.ecore.EStructuralFeature feature) protected final ContainmentComparisonNodefindChildNodeByMatchedId(IComparisonSession session, ComparisonNode parent, MatchedEmfObjects matched) getClassFeatures(AbstractComparedEmfObjects<?> comparingObject, IComparisonSession session, boolean alwaysRecalculate) Returns lists of features of the given EObjects being compared.getClassFeatures(org.eclipse.emf.ecore.EObject object, IComparisonSession session) Returns lists of features of the given EObject.protected IEmfObjectMatchergetCustomMatcher(TopComparisonNode topNode, org.eclipse.emf.ecore.EReference reference, ComparisonContext comparisonContext) Returns a custom matcher for the specified reference.protected abstract StringgetExternalPropertyQualifyingType(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 StringgetExternalPropertySymlink(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 StringgetFeatureTypeDescription(org.eclipse.emf.ecore.EStructuralFeature feature) getForcedDDRebuildScope(TopComparisonNode topNode, MergeContext context) In case if the merge process changes the top object it should supply information about affected DDs.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 StringgetMultiReferenceValueSymlink(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 ComparisonNodeFactoryGets factory to create new comparison nodes.protected org.eclipse.emf.ecore.EStructuralFeaturegetOtherSideFeature(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 PathgetPictureResourcePath(PictureDef picture, IComparisonDataSource dataSource) Returns the picture resource path for the given data source.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.QualifiedNamegetQualifiedName(String symlink) Splits the given symlink into segments and returns them as aQualifiedName.protected StringgetSingleReferenceSymlink(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 ComparisonNodegetTopNode(ComparisonNode node) protected booleanhasConflictChangesInCollection(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.EObjectimportEmfObject(MergeContext context, ComparisonNode mergingNode, org.eclipse.emf.ecore.EObject otherObject) protected voidimportPictureResourceFile(PictureDef picture, MergeContext context) Creates aIPostponedFileOperationto import the other side picture resource.protected booleanisBmIdMayChangeOnMerge(IBmObject bmObject) Tells whether bmId of an object may change during the merge phase.booleanisCandidateForPotentialMergeProblems(ComparisonNode node, IComparisonSession session) Tells whether the given node may break the configuration if it is merged.booleanisExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session) Checks whether the feature must be excluded from the comparison.protected abstract booleanisFeatureWithCustomMerge(org.eclipse.emf.ecore.EStructuralFeature feature) protected booleanisUnmatchableContainment(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 voidmergeEmfProperties(MergeContext context, ComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects) protected voidmergeEmfReference(MergeContext context, ReferenceFeatureComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences) protected voidmergeOtherContainment(MergeContext context, ContainmentFeatureComparisonNode mergingNode, AbstractComparedEmfObjects<?> mergingObjects, ComparedFeatures<org.eclipse.emf.ecore.EReference> comparedReferences) 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 booleanneedCreateOneSideNode(AbstractComparedEmfObjects<?> comparedObjects, ComparisonFlags nodeFlags, boolean threeWay) Checks whether we need to create one-side node for the compared objects.voidonChildrenMerged(TopComparisonNode topNode, MergeContext context) Called when the child nodes of the specified top node have been merged.prepareRenameOperations(IMergeSession mergeSession, ComparisonContext context) Gets a list of rename operations prepared by this participant.protected voidremoveObjectFromContainerOnMerge(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 voidremoveObjectFromListOnMerge(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.voidrestoreCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session) Restores custom settings for the specified node from the given merge settings container.voidsaveCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session) Saves custom settings for the specified node into the given merge settings container.protected voidsetObjectToContainerOnMerge(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.protected booleanskipFeatureOnImportEmfObject(org.eclipse.emf.ecore.EStructuralFeature feature) Indicates whether theEStructuralFeatureshould be skipped on object copy during importbooleansupportsCustomMerging(ComparisonNode node, IComparisonSession session) Tells whether the given node supports custom merging.booleansupportsMergingUsingExternalTool(ComparisonNode node, IComparisonSession session) Tells whether the given node supports merging using external tool.booleansupportsPrioritizedMerging(ComparisonNode node, IComparisonSession session) Tells whether the given node supports prioritized merging.protected voidtranslateReferencesInImportedObject(org.eclipse.emf.ecore.EObject eObject, MergeContext mergeContext) protected voidupdatePictureResourceFile(PictureDef mainPicture, PictureDef otherPicture, IMergeSession session) Updates the main picture resource file with the other picture resource.protected org.eclipse.emf.ecore.EObjectwrapOtherReference(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, waitMethods 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 Details
-
scopeProvider
protected org.eclipse.xtext.scoping.IScopeProvider scopeProvider -
LOG_TYPES
protected static final boolean LOG_TYPES- See Also:
-
topObjectFqnGenerator
-
qualifiedNameFilePathConverter
-
pictureManager
-
projectFileSystemSupportProvider
-
-
Constructor Details
-
AbstractEmfBasedComparisonParticipant
protected AbstractEmfBasedComparisonParticipant()Creates new participant instance with default comparison nodes factory. -
AbstractEmfBasedComparisonParticipant
Creates new participant instance with specific comparison nodes factory.- Parameters:
nodeFactory- the node factory to use, cannot benull
-
-
Method Details
-
prepareRenameOperations
public List<IRenameOnMergeOperation> prepareRenameOperations(IMergeSession mergeSession, ComparisonContext context) Description copied from interface:IComparisonParticipantGets a list of rename operations prepared by this participant.- Specified by:
prepareRenameOperationsin interfaceIComparisonParticipant- Parameters:
mergeSession- the merge session, notnullcontext- the comparison context, notnull- Returns:
- the list of rename operations, never
null
-
clear
public void clear()Description copied from interface:IComparisonParticipantClears the participant caches.- Specified by:
clearin interfaceIComparisonParticipant
-
supportsPrioritizedMerging
Description copied from interface:IComparisonParticipantTells whether the given node supports prioritized merging.- Specified by:
supportsPrioritizedMergingin interfaceIComparisonParticipant- Parameters:
node- the node to check, cannot benullsession- the comparison session, cannot benull- Returns:
trueif the node supports prioritized merging,falseotherwise
-
supportsCustomMerging
Description copied from interface:IComparisonParticipantTells whether the given node supports custom merging.- Specified by:
supportsCustomMergingin interfaceIComparisonParticipant- Parameters:
node- the node to check, cannot benullsession- the comparison session, cannot benull- Returns:
trueif the node supports custom merging,falseotherwise
-
supportsMergingUsingExternalTool
Description copied from interface:IComparisonParticipantTells whether the given node supports merging using external tool.- Specified by:
supportsMergingUsingExternalToolin interfaceIComparisonParticipant- Parameters:
node- the comparison node to check, cannot benullsession- the comparison session, cannot benull- Returns:
trueif the node supports merging using external tool,falseotherwise
-
isExcludedFromComparison
public boolean isExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session) Description copied from interface:IComparisonParticipantChecks whether the feature must be excluded from the comparison.- Specified by:
isExcludedFromComparisonin interfaceIComparisonParticipant- Parameters:
feature- the feature to check, cannot benullcomparedContextObjects- the triple of compared objects, cannot benullsession- the comparison session, cannot benull- Returns:
trueif the feature must be excluded,falseotherwise
-
onChildrenMerged
Description copied from interface:IComparisonParticipantCalled when the child nodes of the specified top node have been merged.- Specified by:
onChildrenMergedin interfaceIComparisonParticipant- Parameters:
topNode- the top node, notnullcontext- Current merge operation context, notnull
-
getForcedDDRebuildScope
public Map<String,IBmObject> getForcedDDRebuildScope(TopComparisonNode topNode, MergeContext context) Description copied from interface:IComparisonParticipantIn case if the merge process changes the top object it should supply information about affected DDs.- Specified by:
getForcedDDRebuildScopein interfaceIComparisonParticipant- Parameters:
topNode- The top node of the comparison model representing the merged object, notnullcontext- 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:IComparisonParticipantConverts, if possible, the main side feature into a other supported by the other side object.- Specified by:
adoptMainSideFeaturein interfaceIComparisonParticipant- Parameters:
mainSideFeature- the main side feature to convert, cannot benullsession- 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:IComparisonParticipantSaves 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:
saveCustomSettingsin interfaceIComparisonParticipant- Parameters:
node- the comparison node to save custom settings for, cannot benullcontainer- the container of serializable settings, cannot benullsession- the comparison session, cannot benull
-
restoreCustomSettings
public void restoreCustomSettings(ComparisonNode node, SerializableMergeSettings container, IComparisonSession session) Description copied from interface:IComparisonParticipantRestores custom settings for the specified node from the given merge settings container.- Specified by:
restoreCustomSettingsin interfaceIComparisonParticipant- Parameters:
node- the comparison node to restore custom settings for, cannot benullcontainer- the container of serializable settings, cannot benullsession- the comparison session, cannot benull
-
isCandidateForPotentialMergeProblems
public boolean isCandidateForPotentialMergeProblems(ComparisonNode node, IComparisonSession session) Description copied from interface:IComparisonParticipantTells whether the given node may break the configuration if it is merged.- Specified by:
isCandidateForPotentialMergeProblemsin interfaceIComparisonParticipant- Parameters:
node- the node to check, cannot benullsession- the comparison session, cannot benull- Returns:
trueif the node may break the configuration,falseotherwise
-
getPotentialMergeProblemsDescriptions
public List<PotentialMergeProblemDescription> getPotentialMergeProblemsDescriptions(ComparisonNode node, ComparisonContext comparisonContext) Description copied from interface:IComparisonParticipantReturns human-readable descriptions of potential merge problems if the the specified node is merged.- Specified by:
getPotentialMergeProblemsDescriptionsin interfaceIComparisonParticipant- Parameters:
node- the node to get merge problems descriptions for, cannot benullcomparisonContext- 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:IComparisonParticipantMerges nodes using an external tool that are supported by this participant.- Specified by:
mergeUsingExternalToolin interfaceIComparisonParticipant- Parameters:
node- the comparison node, cannot benullcomparisonContext- the comparison context, cannot benullmonitor- the progress monitor, cannot benull- Returns:
- the external merge tool result or
nullif 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 benulloriginalObject- the original object, cannot benullimportedObject- the imported object, cannot benullthe- current merge context, cannot benull
-
createClassFeaturesInstance
Creates new instance ofAbstractEmfBasedComparisonParticipant.EObjectClassFeaturesclass. Override in descendants if the class is to be extended.- Returns:
- the instance of
AbstractEmfBasedComparisonParticipant.EObjectClassFeaturesclass, 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 benullsession- the comparison session, cannot benull- Returns:
- the filled
AbstractEmfBasedComparisonParticipant.EObjectClassFeaturesinstance, 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 benullsession- the comparison session, cannot benullalwaysRecalculate- tells whether EObject class features should be always recalculated- Returns:
- the filled
AbstractEmfBasedComparisonParticipant.EObjectClassFeaturesinstance, nevernull
-
getFeatureTypeDescription
-
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 benullnodeProvider- the provider of the node hosting the compared EObject, cannot benullcomparingObject- the triple of parent objects containing the given feature, cannot benullcomparedReferences- the triple of reference features to be compared, cannot benullcomparisonContext- 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 benullreference- the single reference feature, cannot benullsession- the comparison session, cannot benullside- the comparison side where the context object lies, cannot benull- Returns:
- symbolic link or
nullif 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 benullreference- the multi-reference feature, cannot benullsession- the comparison session, cannot benullside- 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 benullreference- the multi-reference feature, cannot benulltargetObject- the object to get symbolic link for, cannot benullsession- the comparison session, cannot benullside- the comparison side where the context object lies, cannot benull- Returns:
- symbolic link or
nullin 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 benullnodeProvider- the lazy provider for the parent comparison node, cannot benullcomparingObject- the triple of parent objects containing the specified feature, cannot benullcomparedReferences- the containment features to be compared, cannot benullchildBmIds- collector of indexes of child nodes to be compared later, cannot benullcomparisonContext- 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:
trueif 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 benullnodeProvider- the parent node provider, cannot benullcomparingObject- the triple of objects being compared, cannot benullchildBmIds- the wrapper of child object indices, can benullcomparisonContext- 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
nullif 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 specifiedEObjects have identicalEClasses.- Parameters:
object1- the firstEObjectobject2- 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
-
importEmfObject
protected org.eclipse.emf.ecore.EObject importEmfObject(MergeContext context, ComparisonNode mergingNode, org.eclipse.emf.ecore.EObject otherObject) -
skipFeatureOnImportEmfObject
protected boolean skipFeatureOnImportEmfObject(org.eclipse.emf.ecore.EStructuralFeature feature) Indicates whether theEStructuralFeatureshould be skipped on object copy during import- Parameters:
feature- the feature to check, cannot benull- Returns:
trueif feature should be skipped
-
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- theEReferenceto the external propertyside- the comparison sideeObject- theEObjectreferencing 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:
trueif the collection should be treated as containing conflicts,falseotherwise
-
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 benullcomparisonContext- the current comparison context, can not benull- Returns:
- the resulting flags, never
null
-
importPictureResourceFile
Creates aIPostponedFileOperationto import the other side picture resource.- Parameters:
picture- the other side picture to create an add operation for, can not benullcontext- 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 benullotherPicture- the other side picture, can not benullsession- the merge session, can not benull
-
deletePictureResourceFile
Deletes the main picture resource file.- Parameters:
mainPicture- the main side picture, can not benullsession- the merge session, can not benull
-
getPictureResourcePath
Returns the picture resource path for the given data source. By default returnsnull.- Parameters:
picture- the picture to get resource path for, cannot benulldataSource- 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 sideEClassinto a main supported by the main side to import object.- Parameters:
otherEClass- the other sideEClassto convert, cannot benullsession- 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 benullsession- 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 benullnodeFlags- the node flags calculated for it, cannot benullthreeWay- is three-way merge- Returns:
trueif need to create the node in the model,falseotherwise
-
getQualifiedName
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 benullmainList- the list to remove the object from, cannot benullmainObject- 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 benullmainContainer- the container to remove from, cannot benullmainReference- the reference to remove object by, cannot benullmainObject- 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 benullmergingNode- the comparison node related to the merging feature, cannot benullmainContainer- the container to add into, cannot benullmainReference- the reference to add object by, cannot benulleObject- the object to be added, cannot benull
-
isBmIdMayChangeOnMerge
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:
trueif bmId may change,falseotherwise
-
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)
-