Class MergeViewerContentProvider

java.lang.Object
org.eclipse.compare.internal.MergeViewerContentProvider
All Implemented Interfaces:
IMergeViewerContentProvider, IContentProvider
Direct Known Subclasses:
MirroredMergeViewerContentProvider

public class MergeViewerContentProvider extends Object implements IMergeViewerContentProvider
Adapts any ContentMergeViewer to work on an ICompareInput e.g. a DiffNode.
  • Field Details

  • Constructor Details

  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: IContentProvider
      Disposes of this content provider. This is called by the viewer when it is disposed.

      The viewer should not be updated during this call, as it is in the process of being disposed.

      The default implementation does nothing.

      Specified by:
      dispose in interface IContentProvider
    • inputChanged

      public void inputChanged(Viewer v, Object o1, Object o2)
      Description copied from interface: IContentProvider
      Notifies this content provider that the given viewer's input has been switched to a different element.

      A typical use for this method is registering the content provider as a listener to changes on the new input (using model-specific means), and deregistering the viewer from the old input. In response to these change notifications, the content provider should update the viewer (see the add, remove, update and refresh methods on the viewers).

      The viewer should not be updated during this call, as it might be in the process of being disposed.

      The default implementation does nothing.

      Specified by:
      inputChanged in interface IContentProvider
      Parameters:
      v - the viewer
      o1 - the old input element, or null if the viewer did not previously have an input
      o2 - the new input element, or null if the viewer does not have an input
    • setAncestorError

      public void setAncestorError(String errorMessage)
    • getAncestorLabel

      public String getAncestorLabel(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns the label for the ancestor side of a ContentMergeViewer.
      Specified by:
      getAncestorLabel in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the label for the ancestor side of a ContentMergeViewer
    • getAncestorImage

      public Image getAncestorImage(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns an optional image for the ancestor side of a ContentMergeViewer.
      Specified by:
      getAncestorImage in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the image for the ancestor side of a ContentMergeViewer, or null if none
    • getAncestorContent

      public Object getAncestorContent(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns the contents for the ancestor side of a ContentMergeViewer. The interpretation of the returned object depends on the concrete ContentMergeViewer.
      Specified by:
      getAncestorContent in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the content for the ancestor side of a ContentMergeViewer, or null if none
    • showAncestor

      public boolean showAncestor(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns whether the ancestor side of the given input element should be shown.
      Specified by:
      showAncestor in interface IMergeViewerContentProvider
      Parameters:
      element - the merge viewer's input
      Returns:
      true if the ancestor side of the given input element should be shown
    • setLeftError

      public void setLeftError(String errorMessage)
    • getLeftLabel

      public String getLeftLabel(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns the label for the left side of a ContentMergeViewer.
      Specified by:
      getLeftLabel in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the label for the left side of a ContentMergeViewer
    • getLeftImage

      public Image getLeftImage(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns an optional image for the left side of a ContentMergeViewer.
      Specified by:
      getLeftImage in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the image for the left side of a ContentMergeViewer, or null if none
    • getLeftContent

      public Object getLeftContent(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns the contents for the left side of a ContentMergeViewer. The interpretation of the returned object depends on the concrete ContentMergeViewer.
      Specified by:
      getLeftContent in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the content for the left side of a ContentMergeViewer, or null if none
    • isLeftEditable

      public boolean isLeftEditable(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns whether the left side is editable.
      Specified by:
      isLeftEditable in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      true if the left side of a ContentMergeViewer is editable
    • saveLeftContent

      public void saveLeftContent(Object element, byte[] bytes)
      Description copied from interface: IMergeViewerContentProvider
      Saves new contents for the left side of the ContentMergeViewer.
      Specified by:
      saveLeftContent in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      bytes - the new contents to save for the left side
    • setRightError

      public void setRightError(String errorMessage)
    • getRightLabel

      public String getRightLabel(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns the label for the right side of a ContentMergeViewer.
      Specified by:
      getRightLabel in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the label for the right side of a ContentMergeViewer
    • getRightImage

      public Image getRightImage(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns an optional image for the right side of a ContentMergeViewer.
      Specified by:
      getRightImage in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the image for the right side of a ContentMergeViewer, or null if none
    • getRightContent

      public Object getRightContent(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns the contents for the right side of a ContentMergeViewer. The interpretation of the returned object depends on the concrete ContentMergeViewer.
      Specified by:
      getRightContent in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      the content for the right side of a ContentMergeViewer, or null if none
    • isRightEditable

      public boolean isRightEditable(Object element)
      Description copied from interface: IMergeViewerContentProvider
      Returns whether the right side is editable.
      Specified by:
      isRightEditable in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      Returns:
      true if the right side of a ContentMergeViewer is editable
    • saveRightContent

      public void saveRightContent(Object element, byte[] bytes)
      Description copied from interface: IMergeViewerContentProvider
      Saves new contents for the right side of the ContentMergeViewer.
      Specified by:
      saveRightContent in interface IMergeViewerContentProvider
      Parameters:
      element - the input object of the ContentMergeViewer
      bytes - the new contents to save for the right side