Package org.eclipse.emf.compare.rcp.ui.internal.mergeviewer

# Class CompareColorImpl

java.lang.Object
org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.CompareColorImpl

All Implemented Interfaces:
  `com.google.common.cache.RemovalListener<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color>`, `ICompareColor`

Direct Known Subclasses:
  `EMFCompareColor`

public class CompareColorImpl extends Object implements com.google.common.cache.RemovalListener<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color>, ICompareColor
Default implementation that use a cache to store created Color and that is listening to a preference store for color configuration.

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.emf.compare.rcp.ui.mergeviewer.ICompareColor

`ICompareColor.Provider`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CONFLICTING_CHANGE_COLOR_THEME_KEY`
Conflicting color key in theme
`static final String`
`INCOMING_CHANGE_COLOR_THEME_KEY`
Incoming color key in theme
`static final String`
`OUTGOING_CHANGE_COLOR_THEME_KEY`
Outgoing color key in theme
`static final String`
`REQUIRED_DIFF_COLOR_THEME_KEY`
Required difference color key in theme
`static final String`
`UNMERGEABLE_DIFF_COLOR_THEME_KEY`
Unmergeable difference color key in theme

## Constructor Summary

Constructors
Constructor
Description
`CompareColorImpl(org.eclipse.swt.widgets.Display fDisplay, boolean leftIsLocal, org.eclipse.jface.resource.ColorRegistry colorRegistry)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`dispose()`
Dispose all `Color` resources.
`org.eclipse.swt.graphics.Color`
`getFillColor(Diff diff, boolean isThreeWay, boolean isIgnoreAncestor, boolean selected)`
Return the color of the background of the decorator of the given `diff`.
`org.eclipse.swt.graphics.Color`
`getRequiredFillColor()`
Get the color for Required change.
`org.eclipse.swt.graphics.Color`
`getRequiredStrokeColor()`
Get the color for Required change border items.
`org.eclipse.swt.graphics.Color`
`getStrokeColor(Diff diff, boolean isThreeWay, boolean isIgnoreAncestor, boolean selected)`
Return the color of the stroke of the decorator of the given `diff`.
`org.eclipse.swt.graphics.Color`
`getUnmergeableFillColor()`
Get the color for Unmergeable difference.
`org.eclipse.swt.graphics.Color`
`getUnmergeableStrokeColor()`
Get the color for Unmergeable difference border items.
`final void`
`onRemoval(com.google.common.cache.RemovalNotification<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color> notification)`
`protected final void`
`updateColors()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### INCOMING_CHANGE_COLOR_THEME_KEY

public static final String INCOMING_CHANGE_COLOR_THEME_KEY
Incoming color key in theme

See Also:
  - Constant Field Values

### CONFLICTING_CHANGE_COLOR_THEME_KEY

public static final String CONFLICTING_CHANGE_COLOR_THEME_KEY
Conflicting color key in theme

See Also:
  - Constant Field Values

### OUTGOING_CHANGE_COLOR_THEME_KEY

public static final String OUTGOING_CHANGE_COLOR_THEME_KEY
Outgoing color key in theme

See Also:
  - Constant Field Values

### REQUIRED_DIFF_COLOR_THEME_KEY

public static final String REQUIRED_DIFF_COLOR_THEME_KEY
Required difference color key in theme

See Also:
  - Constant Field Values

### UNMERGEABLE_DIFF_COLOR_THEME_KEY

public static final String UNMERGEABLE_DIFF_COLOR_THEME_KEY
Unmergeable difference color key in theme

See Also:
  - Constant Field Values

## Constructor Details

### CompareColorImpl

public CompareColorImpl(org.eclipse.swt.widgets.Display fDisplay, boolean leftIsLocal, org.eclipse.jface.resource.ColorRegistry colorRegistry)
Constructor. With this constructor the colors will disposed at the same as the control.

Parameters:
  `leftIsLocal` -
  `colorRegistry` - ColorRegistry where to find all needed color. Those color will be available through the constants: (UNMERGEABLE_DIFF_COLOR_THEME_KEY, REQUIRED_DIFF_COLOR_THEME_KEY, RESOLVED_CHANGE_COLOR_THEME_KEY, OUTGOING_CHANGE_COLOR_THEME_KEY, CONFLICTING_CHANGE_COLOR_THEME_KEY, INCOMING_CHANGE_COLOR_THEME_KEY)
  `control` - Use for get `Display`. The colors will be disposed with the control.

## Method Details

### onRemoval

public final void onRemoval(com.google.common.cache.RemovalNotification<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color> notification)

Specified by:
  `onRemoval` in interface `com.google.common.cache.RemovalListener<org.eclipse.swt.graphics.RGB,org.eclipse.swt.graphics.Color>`

### getFillColor

public org.eclipse.swt.graphics.Color getFillColor(Diff diff, boolean isThreeWay, boolean isIgnoreAncestor, boolean selected)
Return the color of the background of the decorator of the given `diff`.

Specified by:
  `getFillColor` in interface `ICompareColor`
Parameters:
  `diff` - the diff to be decorated.
  `isThreeWay` - are we comparing three models.
  `isIgnoreAncestor` - if the ancestor has to be ignored (i.e. ignore the isThreeWay parameter).
  `selected` - if the given `diff` is selected in the viewer.
Returns:
  the background color.
See Also:
  - invalid reference

        org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.ICompareColor#getFillColor(org.eclipse.emf.compare.Diff, boolean, boolean, boolean)

### getStrokeColor

public org.eclipse.swt.graphics.Color getStrokeColor(Diff diff, boolean isThreeWay, boolean isIgnoreAncestor, boolean selected)
Return the color of the stroke of the decorator of the given `diff`.

Specified by:
  `getStrokeColor` in interface `ICompareColor`
Parameters:
  `diff` - the diff to be decorated.
  `isThreeWay` - are we comparing three models.
  `isIgnoreAncestor` - if the ancestor has to be ignored (i.e. ignore the isThreeWay parameter).
  `selected` - if the given `diff` is selected in the viewer.
Returns:
  the background color.
See Also:
  - invalid reference

        org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.ICompareColor#getStrokeColor(org.eclipse.emf.compare.Diff, boolean, boolean, boolean)

### updateColors

protected final void updateColors()

### dispose

public void dispose()
Dispose all `Color` resources.

Specified by:
  `dispose` in interface `ICompareColor`
See Also:
  - invalid reference

        org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.ICompareColor#dispose()

### getRequiredFillColor

public org.eclipse.swt.graphics.Color getRequiredFillColor()
Get the color for Required change.

Specified by:
  `getRequiredFillColor` in interface `ICompareColor`
Returns:

### getUnmergeableFillColor

public org.eclipse.swt.graphics.Color getUnmergeableFillColor()
Get the color for Unmergeable difference.

Specified by:
  `getUnmergeableFillColor` in interface `ICompareColor`
Returns:

### getRequiredStrokeColor

public org.eclipse.swt.graphics.Color getRequiredStrokeColor()
Get the color for Required change border items. This color is computed from `ICompareColor.getRequiredFillColor()`

Specified by:
  `getRequiredStrokeColor` in interface `ICompareColor`
Returns:

### getUnmergeableStrokeColor

public org.eclipse.swt.graphics.Color getUnmergeableStrokeColor()
Get the color for Unmergeable difference border items. This color is computed from `ICompareColor.getUnmergeableFillColor()`

Specified by:
  `getUnmergeableStrokeColor` in interface `ICompareColor`
Returns: