Class DiffNode

    • Constructor Detail

      • DiffNode

        public DiffNode​(IDiffContainer parent,
                        int kind,
                        ITypedElement ancestor,
                        ITypedElement left,
                        ITypedElement right)
        Creates a new DiffNode and initializes with the given values.
        Parameters:
        parent - under which the new container is added as a child or null
        kind - of difference (defined in Differencer)
        ancestor - the common ancestor input to a compare
        left - the left input to a compare
        right - the right input to a compare
      • DiffNode

        public DiffNode​(ITypedElement left,
                        ITypedElement right)
        Creates a new DiffNode with diff kind Differencer.CHANGE and initializes with the given values.
        Parameters:
        left - the left input to a compare
        right - the right input to a compare
      • DiffNode

        public DiffNode​(int kind,
                        ITypedElement ancestor,
                        ITypedElement left,
                        ITypedElement right)
        Creates a new DiffNode and initializes with the given values.
        Parameters:
        kind - of difference (defined in Differencer)
        ancestor - the common ancestor input to a compare
        left - the left input to a compare
        right - the right input to a compare
      • DiffNode

        public DiffNode​(int kind)
        Creates a new DiffNode with the given diff kind.
        Parameters:
        kind - of difference (defined in Differencer)
      • DiffNode

        public DiffNode​(IDiffContainer parent,
                        int kind)
        Creates a new DiffNode and initializes with the given values.
        Parameters:
        parent - under which the new container is added as a child or null
        kind - of difference (defined in Differencer)
    • Method Detail

      • fireChange

        protected void fireChange()
        Sends out notification that a change has occurred on the ICompareInput.
      • dontExpand

        public boolean dontExpand()
        Returns true if this node shouldn't automatically be expanded in a DiffTreeViewer.
        Returns:
        true if node shouldn't automatically be expanded
      • setDontExpand

        public void setDontExpand​(boolean dontExpand)
        Controls whether this node is not automatically expanded when displayed in a DiffTreeViewer.
        Parameters:
        dontExpand - if true this node is not automatically expanded in DiffTreeViewer
      • getId

        public ITypedElement getId()
        Returns the first not-null input of this node. Method checks the three inputs in the order: ancestor, right, left.
        Returns:
        the first not-null input of this node
      • getName

        public String getName()
        Returns the (non-null) name of the left or right side if they are identical. Otherwise both names are concatenated (separated with a slash ('/')).

        Subclasses may re-implement to provide a different name for this node.

        Specified by:
        getName in interface ICompareInput
        Specified by:
        getName in interface ITypedElement
        Returns:
        the name of this node.
      • getType

        public String getType()
        Description copied from class: DiffElement
        The DiffElement implementation of this ITypedElement method returns ITypedElement.UNKNOWN_TYPE. Subclasses may re-implement to provide a type for this element.
        Specified by:
        getType in interface ITypedElement
        Overrides:
        getType in class DiffElement
        Returns:
        ITypedElement.UNKNOWN_TYPE.
      • setAncestor

        public void setAncestor​(ITypedElement ancestor)
        Sets the ancestor input to the given value.
        Parameters:
        ancestor - the new value for the ancestor input
        Since:
        3.0
      • getAncestor

        public ITypedElement getAncestor()
        Description copied from interface: ICompareInput
        Returns the ancestor side of this input. Returns null if this input has no ancestor or in the two-way compare case.
        Specified by:
        getAncestor in interface ICompareInput
        Returns:
        the ancestor of this input, or null
      • setLeft

        public void setLeft​(ITypedElement left)
        Sets the left input to the given value.
        Parameters:
        left - the new value for the left input
      • getLeft

        public ITypedElement getLeft()
        Description copied from interface: ICompareInput
        Returns the left side of this input. Returns null if there is no left side (deletion or addition).
        Specified by:
        getLeft in interface ICompareInput
        Returns:
        the left side of this input, or null
      • setRight

        public void setRight​(ITypedElement right)
        Sets the right input to the given value.
        Parameters:
        right - the new value for the right input
      • getRight

        public ITypedElement getRight()
        Description copied from interface: ICompareInput
        Returns the right side of this input. Returns null if there is no right side (deletion or addition).
        Specified by:
        getRight in interface ICompareInput
        Returns:
        the right side of this input, or null
      • copy

        public void copy​(boolean leftToRight)
        Description copied from interface: ICompareInput
        Copy one side (source) to the other side (destination) depending on the value of leftToRight. This method is called from a merge viewer if a corresponding action ("take left" or "take right") has been pressed.

        The implementation should handle the following cases:

        • if the source side is null the destination must be deleted,
        • if the destination is null the destination must be created and filled with the contents from the source,
        • if both sides are non-null the contents of source must be copied to destination.
        In addition the implementation should send out notification to the registered ICompareInputChangeListener.
        Specified by:
        copy in interface ICompareInput
        Parameters:
        leftToRight - if true the left side is copied to the right side. If false the right side is copied to the left side
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object