Class BasicDifferenceGroupImpl

    • Field Detail

      • E_ALL_CONTENTS

        protected static final com.google.common.base.Function<EObject,​Iterator<EObject>> E_ALL_CONTENTS
        Function that returns all contents of the given EObject.
      • filter

        protected final com.google.common.base.Predicate<? super Diff> filter
        The filter we'll use in order to filter the differences that are part of this group.
      • name

        protected final String name
        The name that the EMF Compare UI will display for this group.
      • image

        protected final org.eclipse.swt.graphics.Image image
        The icon that the EMF Compare UI will display for this group.
      • children

        protected List<TreeNode> children
        The list of children of this group.
    • Constructor Detail

      • BasicDifferenceGroupImpl

        public BasicDifferenceGroupImpl​(Comparison comparison,
                                        com.google.common.base.Predicate<? super Diff> filter,
                                        ECrossReferenceAdapter crossReferenceAdapter)
        Instantiates this group given the comparison and filter that should be used in order to determine its list of differences.

        This will use the default name and icon for the group.

        Parameters:
        comparison - The comparison that is the parent of this group.
        filter - The filter we'll use in order to filter the differences that are part of this group.
        crossReferenceAdapter - The cross reference adapter that will be added to this group's children.
      • BasicDifferenceGroupImpl

        public BasicDifferenceGroupImpl​(Comparison comparison,
                                        com.google.common.base.Predicate<? super Diff> filter,
                                        String name,
                                        ECrossReferenceAdapter crossReferenceAdapter)
        Instantiates this group given the comparison and filter that should be used in order to determine its list of differences. It will be displayed in the UI with the default icon and the given name.
        Parameters:
        comparison - The comparison that is the parent of this group.
        filter - The filter we'll use in order to filter the differences that are part of this group.
        name - The name that the EMF Compare UI will display for this group.
        crossReferenceAdapter - The cross reference adapter that will be added to this group's children.
      • BasicDifferenceGroupImpl

        public BasicDifferenceGroupImpl​(Comparison comparison,
                                        com.google.common.base.Predicate<? super Diff> filter,
                                        String name,
                                        org.eclipse.swt.graphics.Image image,
                                        ECrossReferenceAdapter crossReferenceAdapter)
        Instantiates this group given the comparison and filter that should be used in order to determine its list of differences. It will be displayed in the UI with the given icon and name.
        Parameters:
        comparison - The comparison that is the parent of this group.
        filter - The filter we'll use in order to filter the differences that are part of this group.
        name - The name that the EMF Compare UI will display for this group.
        image - The icon that the EMF Compare UI will display for this group.
        crossReferenceAdapter - Updated upstream The cross reference adapter that will be added to this group's children.
    • Method Detail

      • getComparison

        protected final Comparison getComparison()
        Returns the comparison object.
        Returns:
        the comparison object.
      • getImage

        public org.eclipse.swt.graphics.Image getImage()
        The icon that is to be used for this group in the compare UI.
        Specified by:
        getImage in interface IDifferenceGroup
        Returns:
        Icon that is to be used for this group in the compare UI. If null, a default image will be used instead.
        See Also:
        IDifferenceGroup.getImage()
      • registerCrossReferenceAdapter

        protected final void registerCrossReferenceAdapter​(List<? extends Notifier> notifiers)
        Registers the CrossReferenceAdapter to all given notifiers.
        Parameters:
        notifiers - the list of notifiers.
      • unregisterCrossReferenceAdapter

        protected final void unregisterCrossReferenceAdapter​(List<? extends Notifier> notifiers)
        Unregisters the CrossReferenceAdapter from all given notifiers.
        Parameters:
        notifiers - the list of notifiers.
      • buildSubTree

        public void buildSubTree()
        Builds the sub tree for this group.
      • doBuildSubTrees

        protected void doBuildSubTrees()
        Perform the creation of the sub-trees of the group.
      • createChildren

        protected List<TreeNode> createChildren()
        This creates the root-level children of the group.
        Returns:
        This default implementation returns a new ArrayList. It may be overridden by sub-classes.
      • buildMatchTrees

        protected List<TreeNode> buildMatchTrees()
        Compute a subTree for each root match of the comparison.
        Returns:
        the list of matchSubTrees
      • buildTree

        protected MatchNode buildTree​(Match match)
        Compute a tree for the given match.
        Parameters:
        match - The given match
        Returns:
        a list of subTree for this match, must not be null
      • populateMatchNode

        protected void populateMatchNode​(MatchNode matchNode)
        Build the subtree for the given match.
        Parameters:
        matchNode - The root matchNode
      • getTargetMatch

        protected Match getTargetMatch​(Diff diff)
        Provide the Match that should directly contain the given diff. If the given diff should not be a direct child of a Match, the method must return null. For a given strategy, a diff should only be displayed in the same Match (i.e. the DiffNodes that represent the diff should always be children of the MatchNodes that represent the returned Match.
        Parameters:
        diff - The difference
        Returns:
        The Match that is a direct parent of the given diff, can be null.
      • mustDisplayAsDirectChildOfMatch

        protected boolean mustDisplayAsDirectChildOfMatch​(Diff diff)
        Does the given difference have to be displayed as direct child of a Match?
        Parameters:
        diff - The diff
        Returns:
        true if the diff's node should be a child of a MatchNode.
      • isContainmentRefChange

        protected boolean isContainmentRefChange​(Diff diff)
        Is it a containment reference change?
        Parameters:
        diff - The diff
        Returns:
        true if the diff is a ReferenceChange whose EReference is a containment reference.
      • buildMatchResourceTrees

        protected List<TreeNode> buildMatchResourceTrees()
      • addDiffNode

        protected void addDiffNode​(MatchNode matchNode,
                                   Diff diff)
        Add the diff in the given match. This method handles refined diffs and allows to customize the result.
        Parameters:
        matchNode - The given match node
        diff - The diff to add
      • createDiffNode

        protected DiffNode createDiffNode​(Diff diff)
        Create a diff node.
        Parameters:
        diff - The given diff
        Returns:
        the DiffNode
      • createMatchNode

        protected MatchNode createMatchNode​(Match match)
        Create a match node.
        Parameters:
        match - The given match
        Returns:
        the MatchNode
      • createConflictNode

        protected ConflictNode createConflictNode​(Conflict conflict)
        Create a conflict node.
        Parameters:
        conflict - The given conflict
        Returns:
        the ConflictNode
      • createMatchResourceNode

        protected MatchResourceNode createMatchResourceNode​(MatchResource matchResource)
        Create a matchResource node.
        Parameters:
        matchResource - The given matchResource
        Returns:
        the MatchResourceNode
      • customize

        protected void customize​(List<? extends TreeNode> nodes)
        Walk the given trees and customize each node in the tree, starting by the deeper nodes all the way up to the root nodes. This method calls itself recursively.
        Parameters:
        nodes - The list of nodes to customize.
      • customize

        protected void customize​(TreeNode treeNode)
        Allow extenders to customize a TreeNode.
        Parameters:
        treeNode - the TreeNode to customize.
      • handleRefiningDiffs

        protected void handleRefiningDiffs​(DiffNode diffNode)
        Handle the diffs that refine the given diff. Refining diffs are added as children of the given diff, and so on recursively.
        Parameters:
        diffNode - The diff node to handle, which is not necessarily a child of a MatchNode since this method is called recursively.