Package org.eclipse.compare
Class CompareConfiguration
java.lang.Object
org.eclipse.compare.CompareConfiguration
A 
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 CompareConfiguration 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.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final String(Optional) id of the common content type for compare input detected by the compare editorstatic final StringName of the ignore whitespace property (value"IGNORE_WHITESPACE").static final StringName of the mirrored property, i.e. if left input is shown on the right side and vice versa.static final StringName of the show pseudo conflicts property (value"SHOW_PSEUDO_CONFLICTS").static final StringName of the use outline view property (value"USE_OUTLINE_VIEW").
- 
Constructor SummaryConstructorsConstructorDescriptionCreates 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.
- 
Method SummaryModifier and TypeMethodDescriptionvoidvoiddispose()Dispose of this compare configuration.getAncestorImage(Object element) Returns the image for the ancestor side of compare/merge viewers.getAncestorLabel(Object element) Returns the label for the ancestor side of compare/merge viewers.Return the container of the compare associated with this configuration.getImage(int kind) Returns an image showing the specified change kind.Returns an image showing the specified change kind applied to a given base image.Return the label provider that is used to determine the text and labels return by this compare configuration.getLeftImage(Object element) Returns the image for the left hand side of compare/merge viewers.getLeftLabel(Object element) Returns the label for the left hand side of compare/merge viewers.Returns the preference store of this configuration.getProperty(String key) Returns the property with the given name, ornullif no such property exists.getRightImage(Object element) Returns the image for the right hand side of compare/merge viewers.getRightLabel(Object element) Returns the label for the right hand side of compare/merge viewers.booleanisChangeIgnored(int kind) Return if a given change kind is ignored while computing differences between documents.booleanReturns whether the left hand side of a merge viewer is editable.booleanOnly the views are mirrored.booleanReturns whether the right hand side of a merge viewer is editable.voidvoidsetAncestorImage(Image image) Sets the image to use for the ancestor of compare/merge viewers.voidsetAncestorLabel(String label) Sets the label to use for the ancestor of compare/merge viewers.voidsetChangeIgnored(int kind, boolean ignored) Set whether given change kind should be ignored while computing differences between documents.voidsetContainer(ICompareContainer container) Set the container of the compare associated with this configuration.voidsetDefaultLabelProvider(ICompareInputLabelProvider labelProvider) Set the default label provider for this configuration.voidsetLabelProvider(ICompareInput input, ICompareInputLabelProvider labelProvider) Set the label provider for the given compare input.voidsetLeftEditable(boolean editable) Controls whether the left side of a merge viewer is editable.voidsetLeftImage(Image image) Sets the image to use for the left side of compare/merge viewers.voidsetLeftLabel(String label) Sets the label to use for the left side of compare/merge viewers.voidsetProperty(String key, Object newValue) Sets the property with the given name.voidsetRightEditable(boolean editable) Controls whether the right side of a merge viewer is editable.voidsetRightImage(Image image) Sets the image to use for the right side of compare/merge viewers.voidsetRightLabel(String label) Sets the label to use for the right side of compare/merge viewers.
- 
Field Details- 
IGNORE_WHITESPACEName of the ignore whitespace property (value"IGNORE_WHITESPACE").- See Also:
 
- 
SHOW_PSEUDO_CONFLICTSName of the show pseudo conflicts property (value"SHOW_PSEUDO_CONFLICTS").- See Also:
 
- 
USE_OUTLINE_VIEWName of the use outline view property (value"USE_OUTLINE_VIEW").- Since:
- 3.0
- See Also:
 
- 
MIRROREDName of the mirrored property, i.e. if left input is shown on the right side and vice versa.- Since:
- 3.7
- See Also:
 
- 
CONTENT_TYPE(Optional) id of the common content type for compare input detected by the compare editor- Since:
- 3.11
- See Also:
 
 
- 
- 
Constructor Details- 
CompareConfigurationCreates a new configuration with editable left and right sides, suitable default labels, and no images. The given preference store is used to connect this configuration with the Compare preference page propertiesComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE,CompareConfiguration.IGNORE_WHITESPACEandMIRRORED- Parameters:
- prefStore- the preference store which this configuration holds onto.
- Since:
- 2.0
 
- 
CompareConfigurationpublic CompareConfiguration()Creates a new configuration with editable left and right sides, suitable default labels, and no images. This configuration uses the preference store of the Compare plug-in (CompareUIPlugin.getDefault().getPreferenceStore()).
 
- 
- 
Method Details- 
getPreferenceStoreReturns the preference store of this configuration.- Returns:
- the preference store of this configuration.
- Since:
- 2.0
 
- 
getImageReturns an image showing the specified change kind. The different kind of changes are defined in theDifferencer. Newly created images are remembered by this class and disposed when thedisposemethod is called.- Parameters:
- kind- the kind of change as defined in- Differencer.
- Returns:
- an modification of the base image reflecting the kind of change
         or nullif there is no image descriptor registered for given id.
- Since:
- 2.0
- See Also:
 
- 
getImageReturns an image showing the specified change kind applied to a given base image. The different kind of changes are defined in theDifferencer. 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 thedisposemethod is called.- Parameters:
- base- the image which is modified to reflect the kind of change
- kind- the kind of change as defined in- Differencer.
- Returns:
- an modification of the base image reflecting the kind of change.
- See Also:
 
- 
isMirroredpublic boolean isMirrored()Only the views are mirrored. All model values for left and right are not changed!- Returns:
- true if the left and right side of the viewer are mirrored. Default is false.
- Since:
- 3.7
 
- 
disposepublic void dispose()Dispose of this compare configuration. This method is called if the compare configuration is no longer used. An implementation must dispose of all resources.
- 
addPropertyChangeListener
- 
removePropertyChangeListener
- 
setPropertySets the property with the given name. If the new value differs from the old aPropertyChangeEventis sent to registered listeners.- Parameters:
- key- the name of the property to set
- newValue- the new value of the property
 
- 
getPropertyReturns the property with the given name, ornullif no such property exists.- Parameters:
- key- the name of the property to retrieve
- Returns:
- the property with the given name, or nullif not found
 
- 
setAncestorLabelSets the label to use for the ancestor of compare/merge viewers. This label will be used if the element for which a label is requested does not have an ancestor or the element does not have a registered label provider or the label provider returnsnullas the label.- Parameters:
- label- the new label for the ancestor of compare/merge viewers
 
- 
getAncestorLabelReturns the label for the ancestor side of compare/merge viewers. This label is typically shown in the title of the ancestor area in a compare viewer.- Parameters:
- element- the input object of a compare/merge viewer or- null
- Returns:
- the label for the ancestor side or null
 
- 
setAncestorImageSets the image to use for the ancestor of compare/merge viewers. The CompareConfiguration does not automatically dispose the old image. This image will be used if the element for which a image is requested does not have an ancestor or the element does not have a registered label provider or the label provider returnsnullas the image.- Parameters:
- image- the new image for the ancestor of compare/merge viewers
 
- 
getAncestorImageReturns the image for the ancestor side of compare/merge viewers. This image is typically shown in the title of the ancestor area in a compare viewer.- Parameters:
- element- the input object of a compare/merge viewer or- null
- Returns:
- the image for the ancestor side or null
 
- 
setLeftEditablepublic void setLeftEditable(boolean editable) Controls whether the left side of a merge viewer is editable.- Parameters:
- editable- if the value is- trueleft side is editable
 
- 
isLeftEditablepublic boolean isLeftEditable()Returns whether the left hand side of a merge viewer is editable.- Returns:
- trueif the left hand side is editable
 
- 
setLeftLabelSets the label to use for the left side of compare/merge viewers. This label will be used if the element for which a label is requested does not have a left contributor or the element does not have a registered label provider or the label provider returnsnullas the label.- Parameters:
- label- the new label for the left side of compare/merge viewers
 
- 
getLeftLabelReturns the label for the left hand side of compare/merge viewers. This label is typically shown in the title of the left side of a compare viewer.- Parameters:
- element- the input object of a compare/merge viewer or- null
- Returns:
- the label for the left hand side or null
 
- 
setLeftImageSets the image to use for the left side of compare/merge viewers. The compare configuration does not automatically dispose the old image. This image will be used if the element for which a image is requested does not have an left contributor or the element does not have a registered label provider or the label provider returnsnullas the image.- Parameters:
- image- the new image for the left side of compare/merge viewers
 
- 
getLeftImageReturns the image for the left hand side of compare/merge viewers. This image is typically shown in the title of the left side of a compare viewer.- Parameters:
- element- the input object of a compare/merge viewer or- null
- Returns:
- the image for the left hand side or null
 
- 
setRightEditablepublic void setRightEditable(boolean editable) Controls whether the right side of a merge viewer is editable.- Parameters:
- editable- if the value is- trueright side is editable
 
- 
isRightEditablepublic boolean isRightEditable()Returns whether the right hand side of a merge viewer is editable.- Returns:
- trueif the right hand side is editable
 
- 
setRightLabelSets the label to use for the right side of compare/merge viewers. This label will be used if the element for which a label is requested does not have an right contributor or the element does not have a registered label provider or the label provider returnsnullas the label.- Parameters:
- label- the new label for the right side of compare/merge viewers
 
- 
getRightLabelReturns the label for the right hand side of compare/merge viewers. This label is typically shown in the title of the right side of a compare viewer.- Parameters:
- element- the input object of a compare/merge viewer or- null
- Returns:
- the label for the right hand side or null
 
- 
setRightImageSets the image to use for the right side of compare/merge viewers. The compare configuration does not automatically dispose the old image. This image will be used if the element for which a image is requested does not have an right contributor or the element does not have a registered label provider or the label provider returnsnullas the image.- Parameters:
- image- the new image for the right side of compare/merge viewers
 
- 
getRightImageReturns the image for the right hand side of compare/merge viewers. This image is typically shown in the title of the right side of a compare viewer.- Parameters:
- element- the input object of a compare/merge viewer or- null
- Returns:
- the image for the right hand side or null
 
- 
getContainerReturn the container of the compare associated with this configuration.- Returns:
- the container of the compare associated with this configuration
- Since:
- 3.3
 
- 
setContainerSet the container of the compare associated with this configuration.- Parameters:
- container- the container of the compare associated with this configuration.
- Since:
- 3.3
 
- 
getLabelProviderReturn the label provider that is used to determine the text and labels return by this compare configuration.- Returns:
- the label provider that is used to determine the text and labels return by this compare configuration
- Since:
- 3.3
- See Also:
 
- 
setLabelProviderSet the label provider for the given compare input. 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.- Parameters:
- input- the compare input
- labelProvider- the label provider for the compare input
- Since:
- 3.3
 
- 
setDefaultLabelProviderSet the default label provider for this configuration. The default label provider is used when a particular label provider has not been assigned usingsetLabelProvider(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.- Parameters:
- labelProvider- the default label provider
- Since:
- 3.3
 
- 
setChangeIgnoredpublic void setChangeIgnored(int kind, boolean ignored) Set whether given change kind should be ignored while computing differences between documents. Changes specified by this method will be excluded from a comparison result.- Parameters:
- 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 set
- Since:
- 3.5
 
- 
isChangeIgnoredpublic boolean isChangeIgnored(int kind) Return if a given change kind is ignored while computing differences between documents.- Parameters:
- kind- type of change, possible values are:- RangeDifference.CHANGE- RangeDifference.CONFLICT- RangeDifference.RIGHT- RangeDifference.LEFT- RangeDifference.ANCESTOR- RangeDifference.ERROR
- Returns:
- whether kind of change is ignored
- Since:
- 3.5
 
 
-