Class MdCompareUtils

java.lang.Object
com._1c.g5.v8.dt.internal.md.compare.MdCompareUtils

public class MdCompareUtils extends Object
Utility methods used for comparison and merge model objects.
  • Field Details

    • CONFIGURATION_TOP_LEVEL_REFS

      public static final Map<String,org.eclipse.emf.ecore.EReference> CONFIGURATION_TOP_LEVEL_REFS
      Collection of all reference to metadata objects from Configuration, without Languages
  • Method Details

    • adoptMainSideFeature

      public static 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. By default returns the given main side feature.
      Parameters:
      mainSideFeature - the main side feature to convert, cannot be null
      session - the comparison session, cannot be null
      Returns:
      the converted feature applicable for other side object or null
    • adoptOtherSideFeature

      public static org.eclipse.emf.ecore.EStructuralFeature adoptOtherSideFeature(org.eclipse.emf.ecore.EStructuralFeature otherSideFeature, IComparisonSession session)
      Converts, if possible, the other side feature into a main supported by the main side object. By default returns the given other side feature.
      Parameters:
      otherSideFeature - the main side feature to convert, cannot be null
      session - the comparison session, cannot be null
      Returns:
      the converted feature applicable for other side object, never null
    • isExcludedFromComparison

      public static boolean isExcludedFromComparison(org.eclipse.emf.ecore.EStructuralFeature feature, AbstractComparedEmfObjects<?> comparedContextObjects, IComparisonSession session, IMdPropertyTypeProvider propertyTypeProvider, IMdAdoptedPropertyAccess adoptedPropertyAccess, org.eclipse.xtext.naming.IQualifiedNameProvider qualifiedNameProvider)
      Checks whether the feature must be excluded from the comparison.
      Parameters:
      feature - the feature to check, cannot be null
      comparedContextObjects - the triple of compared objects, cannot be null
      session - the comparison session, cannot be null
      qualifiedNameProvider - the qualified name provider, cannot be null
      Returns:
      true if the feature must be excluded or false otherwise
    • isObjectToBeRenamed

      public static boolean isObjectToBeRenamed(MdObjectComparisonNode node)
      Checks whether the object may be renamed on merge.
      Parameters:
      node - the node accociated with object to check, cannot be null
      Returns:
      true if the object may be renamed on merge, false otherwise
    • getTopParentEClass

      public static org.eclipse.emf.ecore.EClass getTopParentEClass(String symlink)
      Returns the top model parent EClass of the object represented by the given symlink.
      Parameters:
      symlink - the object symlink to get the top model parent EClass for, cannot be null
      Returns:
      the top model parent EClass, never null
    • getTopParentSymlink

      public static String getTopParentSymlink(String symlink)
      Returns the top model parent symlink of the object represented by the given symlink.
      Parameters:
      symlink - the object symlink to get the top model parent symlink for, cannot be null
      Returns:
      the top model parent symlink, never null
    • getReferenceFromConfiguration

      public static org.eclipse.emf.ecore.EReference getReferenceFromConfiguration(org.eclipse.emf.ecore.EClass eClass)
      Returns a reference from the configuration whose type is equal to the specified EClass.
      Parameters:
      eClass - the EClass to get the reference from the configuration for, cannot be null
      Returns:
      the reference from configuration or null if no such reference is known
    • compareFiles

      public static ComparisonFlags compareFiles(Collection<Path> files, IComparisonSession session)
      Compares a collection of files, takes a content of a file from the comparison data sources.
      Parameters:
      files - the collections of files to compare, cannot be null
      session - the related comparison session, cannot be null
      Returns:
      the comparison result, never null
    • getTopObjectReferences

      public static List<org.eclipse.emf.ecore.EReference> getTopObjectReferences()
      Gets configuration top level navigator ordered references.
      Returns:
      configuration top level navigator ordered references, never null
    • getChildFeatures

      public static List<org.eclipse.emf.ecore.EReference> getChildFeatures(MdObjectCollectionElementComparisonNode node, IComparisonSession comparisonSession)
      Returns features of node in sorted order.
      Parameters:
      node - node for which internal menu structure is to be retrieved, cannot be null
      comparisonSession - session related to node, cannot be null
      Returns:
      features of node in sorted order, may be null if no internal menu structure is found for given node, may be null when unknown node is given