public class CompareConfiguration extends Object
CompareConfiguration
object
controls various UI aspects of compare/merge viewers like
title labels and images, or whether a side of a merge viewer is editable.
In addition to these fixed properties ICompareConfiguration
provides
API for an open ended set of properties. Different viewers which share the same
configuration can communicate via this mechanism. E.g. if a compare editor
has a button for controlling whether compare viewers ignore white space,
the button would trigger a change of the boolean IGNORE_WHITESPACE
property
and all interested viewers would receive notification.
Suitable default labels are provided (without images); both the left and right sides are editable.
Clients may use this class as is, or subclass to add new state and behavior.
Modifier and Type | Field and Description |
---|---|
static String |
IGNORE_WHITESPACE
Name of the ignore whitespace property (value
"IGNORE_WHITESPACE" ). |
static String |
SHOW_PSEUDO_CONFLICTS
Name of the show pseudo conflicts property (value
"SHOW_PSEUDO_CONFLICTS" ). |
static String |
USE_OUTLINE_VIEW
Name of the use outline view property (value
"USE_OUTLINE_VIEW" ). |
Constructor and Description |
---|
CompareConfiguration()
Creates a new configuration with editable left and right sides,
suitable default labels, and no images.
|
CompareConfiguration(IPreferenceStore prefStore)
Creates a new configuration with editable left and right sides,
suitable default labels, and no images.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(IPropertyChangeListener listener) |
void |
dispose()
Dispose of this compare configuration.
|
Image |
getAncestorImage(Object element)
Returns the image for the ancestor side of compare/merge viewers.
|
String |
getAncestorLabel(Object element)
Returns the label for the ancestor side of compare/merge viewers.
|
ICompareContainer |
getContainer()
Return the container of the compare associated with this configuration.
|
Image |
getImage(Image base,
int kind)
Returns an image showing the specified change kind applied to a
given base image.
|
Image |
getImage(int kind)
Returns an image showing the specified change kind.
|
ICompareInputLabelProvider |
getLabelProvider()
Return the label provider that is used to determine the
text and labels return by this compare configuration.
|
Image |
getLeftImage(Object element)
Returns the image for the left hand side of compare/merge viewers.
|
String |
getLeftLabel(Object element)
Returns the label for the left hand side of compare/merge viewers.
|
IPreferenceStore |
getPreferenceStore()
Returns the preference store of this configuration.
|
Object |
getProperty(String key)
Returns the property with the given name, or
null
if no such property exists. |
Image |
getRightImage(Object element)
Returns the image for the right hand side of compare/merge viewers.
|
String |
getRightLabel(Object element)
Returns the label for the right hand side of compare/merge viewers.
|
boolean |
isChangeIgnored(int kind)
Return if a given change kind is ignored while computing differences
between documents.
|
boolean |
isLeftEditable()
Returns whether the left hand side of a merge viewer is editable.
|
boolean |
isRightEditable()
Returns whether the right hand side of a merge viewer is editable.
|
void |
removePropertyChangeListener(IPropertyChangeListener listener) |
void |
setAncestorImage(Image image)
Sets the image to use for the ancestor of compare/merge viewers.
|
void |
setAncestorLabel(String label)
Sets the label to use for the ancestor of compare/merge viewers.
|
void |
setChangeIgnored(int kind,
boolean ignored)
Set whether given change kind should be ignored while computing
differences between documents.
|
void |
setContainer(ICompareContainer container)
Set the container of the compare associated with this configuration.
|
void |
setDefaultLabelProvider(ICompareInputLabelProvider labelProvider)
Set the default label provider for this configuration.
|
void |
setLabelProvider(ICompareInput input,
ICompareInputLabelProvider labelProvider)
Set the label provider for the given compare input.
|
void |
setLeftEditable(boolean editable)
Controls whether the left side of a merge viewer is editable.
|
void |
setLeftImage(Image image)
Sets the image to use for the left side of compare/merge viewers.
|
void |
setLeftLabel(String label)
Sets the label to use for the left side of compare/merge viewers.
|
void |
setProperty(String key,
Object newValue)
Sets the property with the given name.
|
void |
setRightEditable(boolean editable)
Controls whether the right side of a merge viewer is editable.
|
void |
setRightImage(Image image)
Sets the image to use for the right side of compare/merge viewers.
|
void |
setRightLabel(String label)
Sets the label to use for the right side of compare/merge viewers.
|
public static final String IGNORE_WHITESPACE
"IGNORE_WHITESPACE"
).public static final String SHOW_PSEUDO_CONFLICTS
"SHOW_PSEUDO_CONFLICTS"
).public static final String USE_OUTLINE_VIEW
"USE_OUTLINE_VIEW"
).public CompareConfiguration(IPreferenceStore prefStore)
ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE
,
and CompareConfiguration.IGNORE_WHITESPACE
.prefStore
- the preference store which this configuration holds onto.public CompareConfiguration()
CompareUIPlugin.getDefault().getPreferenceStore()
).public IPreferenceStore getPreferenceStore()
public Image getImage(int kind)
Differencer
.
Newly created images are remembered by this class and
disposed when the dispose
method is called.kind
- the kind of change as defined in Differencer
.Differencer
public Image getImage(Image base, int kind)
Differencer
.
Typically an implementation would build a composite image
from the given base image and an image representing the change kind.
Newly created images are remembered by this class and
disposed when the dispose
method is called.base
- the image which is modified to reflect the kind of changekind
- the kind of change as defined in Differencer
.Differencer
public void dispose()
public void addPropertyChangeListener(IPropertyChangeListener listener)
public void removePropertyChangeListener(IPropertyChangeListener listener)
public void setProperty(String key, Object newValue)
PropertyChangeEvent
is sent to registered listeners.key
- the name of the property to setnewValue
- the new value of the propertypublic Object getProperty(String key)
null
if no such property exists.key
- the name of the property to retrievenull
if not foundpublic void setAncestorLabel(String label)
null
as the label.label
- the new label for the ancestor of compare/merge viewerspublic String getAncestorLabel(Object element)
element
- the input object of a compare/merge viewer or null
null
public void setAncestorImage(Image image)
null
as the image.image
- the new image for the ancestor of compare/merge viewerspublic Image getAncestorImage(Object element)
element
- the input object of a compare/merge viewer or null
null
public void setLeftEditable(boolean editable)
editable
- if the value is true
left side is editablepublic boolean isLeftEditable()
true
if the left hand side is editablepublic void setLeftLabel(String label)
null
as the label.label
- the new label for the left side of compare/merge viewerspublic String getLeftLabel(Object element)
element
- the input object of a compare/merge viewer or null
null
public void setLeftImage(Image image)
null
as the image.image
- the new image for the left side of compare/merge viewerspublic Image getLeftImage(Object element)
element
- the input object of a compare/merge viewer or null
null
public void setRightEditable(boolean editable)
editable
- if the value is true
right side is editablepublic boolean isRightEditable()
true
if the right hand side is editablepublic void setRightLabel(String label)
null
as the label.label
- the new label for the right side of compare/merge viewerspublic String getRightLabel(Object element)
element
- the input object of a compare/merge viewer or null
null
public void setRightImage(Image image)
null
as the image.image
- the new image for the right side of compare/merge viewerspublic Image getRightImage(Object element)
element
- the input object of a compare/merge viewer or null
null
public ICompareContainer getContainer()
public void setContainer(ICompareContainer container)
container
- the container of the compare associated with this configuration.public ICompareInputLabelProvider getLabelProvider()
getAncestorImage(Object)
,
getAncestorLabel(Object)
,
getLeftImage(Object)
,
getLeftLabel(Object)
,
getRightImage(Object)
,
getRightLabel(Object)
public void setLabelProvider(ICompareInput input, ICompareInputLabelProvider labelProvider)
input
- the compare inputlabelProvider
- the label provider for the compare inputpublic void setDefaultLabelProvider(ICompareInputLabelProvider labelProvider)
setLabelProvider(ICompareInput, ICompareInputLabelProvider)
.
The compare configuration will not dispose of the label provider when the
configuration is disposed. It is up to the provider of the label provider
to ensure that it is disposed when it is no longer needed.labelProvider
- the default label providerpublic void setChangeIgnored(int kind, boolean ignored)
kind
- type of change, possible values are:
RangeDifference.CHANGE
RangeDifference.CONFLICT
RangeDifference.RIGHT
RangeDifference.LEFT
RangeDifference.ANCESTOR
RangeDifference.ERROR
ignored
- whether given kind should be included in the ignored setpublic boolean isChangeIgnored(int kind)
kind
- type of change, possible values are:
RangeDifference.CHANGE
RangeDifference.CONFLICT
RangeDifference.RIGHT
RangeDifference.LEFT
RangeDifference.ANCESTOR
RangeDifference.ERROR
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.