Package org.eclipse.compare.internal
Class MergeViewerContentProvider
java.lang.Object
org.eclipse.compare.internal.MergeViewerContentProvider
- All Implemented Interfaces:
IMergeViewerContentProvider
,IContentProvider
- Direct Known Subclasses:
MirroredMergeViewerContentProvider
Adapts any
ContentMergeViewer
to work on an ICompareInput
e.g. a DiffNode
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final char
static final char
static final char
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of this content provider.getAncestorContent
(Object element) Returns the contents for the ancestor side of aContentMergeViewer
.getAncestorImage
(Object element) Returns an optional image for the ancestor side of aContentMergeViewer
.getAncestorLabel
(Object element) Returns the label for the ancestor side of aContentMergeViewer
.getLeftContent
(Object element) Returns the contents for the left side of aContentMergeViewer
.getLeftImage
(Object element) Returns an optional image for the left side of aContentMergeViewer
.getLeftLabel
(Object element) Returns the label for the left side of aContentMergeViewer
.getRightContent
(Object element) Returns the contents for the right side of aContentMergeViewer
.getRightImage
(Object element) Returns an optional image for the right side of aContentMergeViewer
.getRightLabel
(Object element) Returns the label for the right side of aContentMergeViewer
.void
inputChanged
(Viewer v, Object o1, Object o2) Notifies this content provider that the given viewer's input has been switched to a different element.boolean
isLeftEditable
(Object element) Returns whether the left side is editable.boolean
isRightEditable
(Object element) Returns whether the right side is editable.void
saveLeftContent
(Object element, byte[] bytes) Saves new contents for the left side of theContentMergeViewer
.void
saveRightContent
(Object element, byte[] bytes) Saves new contents for the right side of theContentMergeViewer
.void
setAncestorError
(String errorMessage) void
setLeftError
(String errorMessage) void
setRightError
(String errorMessage) boolean
showAncestor
(Object element) Returns whether the ancestor side of the given input element should be shown.
-
Field Details
-
ANCESTOR_CONTRIBUTOR
public static final char ANCESTOR_CONTRIBUTOR- See Also:
-
RIGHT_CONTRIBUTOR
public static final char RIGHT_CONTRIBUTOR- See Also:
-
LEFT_CONTRIBUTOR
public static final char LEFT_CONTRIBUTOR- See Also:
-
-
Constructor Details
-
MergeViewerContentProvider
-
-
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 interfaceIContentProvider
-
inputChanged
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 interfaceIContentProvider
- Parameters:
v
- the viewero1
- the old input element, ornull
if the viewer did not previously have an inputo2
- the new input element, ornull
if the viewer does not have an input
-
setAncestorError
-
getAncestorLabel
Description copied from interface:IMergeViewerContentProvider
Returns the label for the ancestor side of aContentMergeViewer
.- Specified by:
getAncestorLabel
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the label for the ancestor side of a
ContentMergeViewer
-
getAncestorImage
Description copied from interface:IMergeViewerContentProvider
Returns an optional image for the ancestor side of aContentMergeViewer
.- Specified by:
getAncestorImage
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the image for the ancestor side of a
ContentMergeViewer
, ornull
if none
-
getAncestorContent
Description copied from interface:IMergeViewerContentProvider
Returns the contents for the ancestor side of aContentMergeViewer
. The interpretation of the returned object depends on the concreteContentMergeViewer
.- Specified by:
getAncestorContent
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the content for the ancestor side of a
ContentMergeViewer
, ornull
if none
-
showAncestor
Description copied from interface:IMergeViewerContentProvider
Returns whether the ancestor side of the given input element should be shown.- Specified by:
showAncestor
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the merge viewer's input- Returns:
true
if the ancestor side of the given input element should be shown
-
setLeftError
-
getLeftLabel
Description copied from interface:IMergeViewerContentProvider
Returns the label for the left side of aContentMergeViewer
.- Specified by:
getLeftLabel
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the label for the left side of a
ContentMergeViewer
-
getLeftImage
Description copied from interface:IMergeViewerContentProvider
Returns an optional image for the left side of aContentMergeViewer
.- Specified by:
getLeftImage
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the image for the left side of a
ContentMergeViewer
, ornull
if none
-
getLeftContent
Description copied from interface:IMergeViewerContentProvider
Returns the contents for the left side of aContentMergeViewer
. The interpretation of the returned object depends on the concreteContentMergeViewer
.- Specified by:
getLeftContent
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the content for the left side of a
ContentMergeViewer
, ornull
if none
-
isLeftEditable
Description copied from interface:IMergeViewerContentProvider
Returns whether the left side is editable.- Specified by:
isLeftEditable
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
true
if the left side of aContentMergeViewer
is editable
-
saveLeftContent
Description copied from interface:IMergeViewerContentProvider
Saves new contents for the left side of theContentMergeViewer
.- Specified by:
saveLeftContent
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
bytes
- the new contents to save for the left side
-
setRightError
-
getRightLabel
Description copied from interface:IMergeViewerContentProvider
Returns the label for the right side of aContentMergeViewer
.- Specified by:
getRightLabel
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the label for the right side of a
ContentMergeViewer
-
getRightImage
Description copied from interface:IMergeViewerContentProvider
Returns an optional image for the right side of aContentMergeViewer
.- Specified by:
getRightImage
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the image for the right side of a
ContentMergeViewer
, ornull
if none
-
getRightContent
Description copied from interface:IMergeViewerContentProvider
Returns the contents for the right side of aContentMergeViewer
. The interpretation of the returned object depends on the concreteContentMergeViewer
.- Specified by:
getRightContent
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
- the content for the right side of a
ContentMergeViewer
, ornull
if none
-
isRightEditable
Description copied from interface:IMergeViewerContentProvider
Returns whether the right side is editable.- Specified by:
isRightEditable
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
- Returns:
true
if the right side of aContentMergeViewer
is editable
-
saveRightContent
Description copied from interface:IMergeViewerContentProvider
Saves new contents for the right side of theContentMergeViewer
.- Specified by:
saveRightContent
in interfaceIMergeViewerContentProvider
- Parameters:
element
- the input object of theContentMergeViewer
bytes
- the new contents to save for the right side
-