Interface ICompareInput

    • Method Detail

      • getName

        String getName()
        Returns name of input. This name is displayed when this input is shown in a viewer. In many cases this name is the name of one of the non-null sides or a combination thereof.
        Returns:
        name of input
      • getImage

        Image getImage()
        Returns an image representing this input. This image is typically displayed when this input is shown in a viewer. In many cases this image is the image of one of the non-null sides.
        Returns:
        image representing this input, or null if no icon should be shown
      • getKind

        int getKind()
        Returns the kind of difference between the three sides ancestor, left and right. This field is only meaningful if the ICompareInput is the result of another compare. In this case it is used together with getImage() to compose an icon which reflects the kind of difference between the two or three elements.
        Returns:
        kind of difference (see Differencer)
      • getAncestor

        ITypedElement getAncestor()
        Returns the ancestor side of this input. Returns null if this input has no ancestor or in the two-way compare case.
        Returns:
        the ancestor of this input, or null
      • getLeft

        ITypedElement getLeft()
        Returns the left side of this input. Returns null if there is no left side (deletion or addition).
        Returns:
        the left side of this input, or null
      • getRight

        ITypedElement getRight()
        Returns the right side of this input. Returns null if there is no right side (deletion or addition).
        Returns:
        the right side of this input, or null
      • addCompareInputChangeListener

        void addCompareInputChangeListener​(ICompareInputChangeListener listener)
        Registers the given listener for notification. If the identical listener is already registered the method has no effect.
        Parameters:
        listener - the listener to register for changes of this input
      • removeCompareInputChangeListener

        void removeCompareInputChangeListener​(ICompareInputChangeListener listener)
        Unregisters the given listener. If the identical listener is not registered the method has no effect.
        Parameters:
        listener - the listener to unregister
      • copy

        void copy​(boolean leftToRight)
        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.
        Parameters:
        leftToRight - if true the left side is copied to the right side. If false the right side is copied to the left side