org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer

## Class EMFCompareContentMergeViewer

- java.lang.Object
- - org.eclipse.jface.viewers.Viewer
  - - org.eclipse.jface.viewers.ContentViewer
    - - org.eclipse.compare.contentmergeviewer.ContentMergeViewer
      - - org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer

All Implemented Interfaces:
  org.eclipse.compare.contentmergeviewer.IFlushable, org.eclipse.compare.internal.IFlushable2, org.eclipse.compare.IPropertyChangeNotifier, org.eclipse.core.runtime.IAdaptable, CommandStackListener, ICompareColor.Provider, org.eclipse.jface.viewers.IInputProvider, org.eclipse.jface.viewers.IInputSelectionProvider, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.jface.viewers.ISelectionProvider

Direct Known Subclasses:
  AbstractTreeContentMergeViewer, TableContentMergeViewer

    public abstract class EMFCompareContentMergeViewer
    extends org.eclipse.compare.contentmergeviewer.ContentMergeViewer
    implements org.eclipse.jface.viewers.ISelectionChangedListener, ICompareColor.Provider, org.eclipse.core.runtime.IAdaptable, CommandStackListener

### Field Summary

Fields
`protected static int` `CENTER_WIDTH` Width of center bar

### Fields inherited from class org.eclipse.jface.viewers.Viewer

`WIDGET_DATA_KEY`

### Constructor Summary

Constructors
`protected` `EMFCompareContentMergeViewer(int style, ResourceBundle bundle, EMFCompareConfiguration cc)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`void` `colorChanged(IColorChangeEvent changeColorEvent)`
`void` `commandStackChanged(EventObject event)`
`protected void` `copy(boolean leftToRight)`
`protected org.eclipse.swt.widgets.Control` `createCenterControl(org.eclipse.swt.widgets.Composite parent)`
`protected void` `createControls(org.eclipse.swt.widgets.Composite composite)`
`protected abstract IMergeViewer` `createMergeViewer(org.eclipse.swt.widgets.Composite parent, IMergeViewer.MergeViewerSide side)` Creates the merge viewer for the given parent and the given side.
`protected void` `createToolItems(org.eclipse.jface.action.ToolBarManager toolBarManager)`
`protected boolean` `doSave(Object newInput, Object oldInput)` Inhibits this method to avoid asking to save on each input change!!
`protected void` `editingDomainChange(ICompareEditingDomain oldValue, ICompareEditingDomain newValue)`
`protected void` `flushContent(Object input, org.eclipse.core.runtime.IProgressMonitor monitor)`
`Object` `getAdapter(Class adapter)`
`protected IMergeViewer` `getAncestorMergeViewer()`
`protected int` `getCenterWidth()`
`ICompareColor` `getCompareColor()` Returns the ICompareColor.
`protected EMFCompareConfiguration` `getCompareConfiguration()`
`org.eclipse.swt.widgets.Composite` `getControl()`
`protected com.google.common.base.Predicate<? super EObject>` `getDifferenceFilterPredicate()`
`protected IDifferenceGroupProvider` `getDifferenceGroupProvider()`
`protected Diff` `getDiffFrom(IMergeViewer viewer)` Checks the element selected in the given viewer in order to determine whether it can be adapted into a Diff.
`protected IMergeViewer.MergeViewerSide` `getEffectiveSide(IMergeViewer.MergeViewerSide side)` Returns the effective side taking into account `CompareConfiguration.isMirrored()` to switch left and right.
`protected org.eclipse.compare.internal.CompareHandlerService` `getHandlerService()`
`protected IMergeViewer` `getLeftMergeViewer()`
`protected IMergeViewer` `getRightMergeViewer()`
`void` `handleAdapterFactoryChange(IAdapterFactoryChange event)`
`void` `handleDifferenceFiltersChange(IDifferenceFilterChange event)`
`void` `handleDifferenceGroupProviderChange(IDifferenceGroupProviderChange event)`
`protected void` `handleDispose(org.eclipse.swt.events.DisposeEvent event)`
`void` `handleEditingDomainChange(ICompareEditingDomainChange event)`
`protected void` `handleMirroredChanged()` This does the processing
`protected void` `handlePropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent event)` This override uses a `MirrorManager` to intercept switches to the swap preference for controlling the mirror mode.
`protected void` `handleResizeAncestor(int x, int y, int width, int height)`
`protected void` `handleResizeLeftRight(int x, int y, int width1, int centerWidth, int width2, int height)`
`protected abstract void` `paintCenter(org.eclipse.swt.graphics.GC g)`
`protected void` `redrawCenterControl()`
`void` `selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)`
`void` `setContentProvider(org.eclipse.jface.viewers.IContentProvider contentProvider)`
`protected void` `updateContent(Object ancestor, Object left, Object right)`

### Methods inherited from class org.eclipse.compare.contentmergeviewer.ContentMergeViewer

`addPropertyChangeListener, buildControl, flush, flushLeft, flushRight, getCenterControl, getContents, getResourceBundle, getSelection, getTitle, getToolBarManager, handleCompareInputChange, handleSetFocus, hookControl, inputChanged, internalIsLeftDirty, internalIsRightDirty, isAncestorVisible, isLeftDirty, isLeftEditable, isRightDirty, isRightEditable, isThreeWay, refresh, removePropertyChangeListener, save, setConfirmSave, setLeftDirty, setRightDirty, setSelection, updateHeader, updateToolItems`

### Methods inherited from class org.eclipse.jface.viewers.ContentViewer

`getContentProvider, getInput, getLabelProvider, handleLabelProviderChanged, labelProviderChanged, setInput, setLabelProvider`

### Methods inherited from class org.eclipse.jface.viewers.Viewer

`addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection`

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

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

### Field Detail

#### CENTER_WIDTH

    protected static final int CENTER_WIDTH

Width of center bar

See Also:
  Constant Field Values

### Constructor Detail

#### EMFCompareContentMergeViewer

    protected EMFCompareContentMergeViewer(int style,
                                           ResourceBundle bundle,
                                           EMFCompareConfiguration cc)

Parameters:
  `style` -
  `bundle` -
  `cc` -

### Method Detail

#### setContentProvider

    public void setContentProvider(org.eclipse.jface.viewers.IContentProvider contentProvider)

Overrides:
  `setContentProvider` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`

#### handleAdapterFactoryChange

    public void handleAdapterFactoryChange(IAdapterFactoryChange event)

#### colorChanged

    public void colorChanged(IColorChangeEvent changeColorEvent)

#### handleEditingDomainChange

    public void handleEditingDomainChange(ICompareEditingDomainChange event)

See Also:
  `org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration#editingDomainChange(org.eclipse.emf.compare.domain.ICompareEditingDomain, org.eclipse.emf.compare.domain.ICompareEditingDomain)`

#### editingDomainChange

    protected void editingDomainChange(ICompareEditingDomain oldValue,
                                       ICompareEditingDomain newValue)

#### handleDifferenceFiltersChange

    public void handleDifferenceFiltersChange(IDifferenceFilterChange event)

#### getDifferenceFilterPredicate

    protected final com.google.common.base.Predicate<? super EObject> getDifferenceFilterPredicate()

Returns:
  the differenceFilterPredicate

#### handleDifferenceGroupProviderChange

    public void handleDifferenceGroupProviderChange(IDifferenceGroupProviderChange event)

#### getDifferenceGroupProvider

    protected final IDifferenceGroupProvider getDifferenceGroupProvider()

Returns:
  the differenceGroupProvider

#### getCompareColor

    public ICompareColor getCompareColor()

Returns the ICompareColor.

Specified by:
  `getCompareColor` in interface `ICompareColor.Provider`
Returns:
  the ICompareColor.
See Also:
  `org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.ICompareColorProvider#getCompareColor()`

#### updateContent

    protected void updateContent(Object ancestor,
                                 Object left,
                                 Object right)

Specified by:
  `updateContent` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.updateContent(java.lang.Object, java.lang.Object, java.lang.Object)`

#### doSave

    protected boolean doSave(Object newInput,
                             Object oldInput)

Inhibits this method to avoid asking to save on each input change!!

Overrides:
  `doSave` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.doSave(java.lang.Object, java.lang.Object)`

#### createControls

    protected void createControls(org.eclipse.swt.widgets.Composite composite)

Specified by:
  `createControls` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.createControls(org.eclipse.swt.widgets.Composite)`

#### getEffectiveSide

    protected IMergeViewer.MergeViewerSide getEffectiveSide(IMergeViewer.MergeViewerSide side)

Returns the effective side taking into account `CompareConfiguration.isMirrored()` to switch left and right.

Parameters:
  `side` -
Returns:
  the effective side with respect to mirroring.

#### createToolItems

    protected void createToolItems(org.eclipse.jface.action.ToolBarManager toolBarManager)

Overrides:
  `createToolItems` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.createToolItems(org.eclipse.jface.action.ToolBarManager)`

#### commandStackChanged

    public void commandStackChanged(EventObject event)

Specified by:
  `commandStackChanged` in interface `CommandStackListener`

#### copy

    protected void copy(boolean leftToRight)

Specified by:
  `copy` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.copy(boolean)`

#### handleResizeAncestor

    protected void handleResizeAncestor(int x,
                                        int y,
                                        int width,
                                        int height)

Specified by:
  `handleResizeAncestor` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.handleResizeAncestor(int, int, int, int)`

#### handleResizeLeftRight

    protected void handleResizeLeftRight(int x,
                                         int y,
                                         int width1,
                                         int centerWidth,
                                         int width2,
                                         int height)

Specified by:
  `handleResizeLeftRight` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.handleResizeLeftRight(int, int, int, int, int, int)`

#### createMergeViewer

    protected abstract IMergeViewer createMergeViewer(org.eclipse.swt.widgets.Composite parent,
                                                      IMergeViewer.MergeViewerSide side)

Creates the merge viewer for the given parent and the given side.

Parameters:
  `parent` - composite in which to create the merge viewer.
  `side` - the side of the new viewer.
Returns:
  a new merge viewer.

#### getCenterWidth

    protected final int getCenterWidth()

Overrides:
  `getCenterWidth` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`

#### getHandlerService

    protected final org.eclipse.compare.internal.CompareHandlerService getHandlerService()

#### getControl

    public org.eclipse.swt.widgets.Composite getControl()

Overrides:
  `getControl` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.getControl()`

#### createCenterControl

    protected org.eclipse.swt.widgets.Control createCenterControl(org.eclipse.swt.widgets.Composite parent)

Overrides:
  `createCenterControl` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.createCenterControl(org.eclipse.swt.widgets.Composite)`

#### paintCenter

    protected abstract void paintCenter(org.eclipse.swt.graphics.GC g)

#### getAdapter

    public Object getAdapter(Class adapter)

Specified by:
  `getAdapter` in interface `org.eclipse.core.runtime.IAdaptable`

#### getAncestorMergeViewer

    protected IMergeViewer getAncestorMergeViewer()

Returns:
  the fAncestor

#### getLeftMergeViewer

    protected IMergeViewer getLeftMergeViewer()

Returns:
  the fLeft

#### getRightMergeViewer

    protected IMergeViewer getRightMergeViewer()

Returns:
  the fRight

#### selectionChanged

    public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)

Specified by:
  `selectionChanged` in interface `org.eclipse.jface.viewers.ISelectionChangedListener`
See Also:
  `ISelectionChangedListener.selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)`

#### getDiffFrom

    protected Diff getDiffFrom(IMergeViewer viewer)

Checks the element selected in the given viewer in order to determine whether it can be adapted into a Diff.

Parameters:
  `viewer` - The viewer which selection is to be checked.
Returns:
  The first of the Diffs selected in the given viewer, if any.

#### handleDispose

    protected void handleDispose(org.eclipse.swt.events.DisposeEvent event)

Overrides:
  `handleDispose` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.handleDispose(org.eclipse.swt.events.DisposeEvent)`

#### redrawCenterControl

    protected final void redrawCenterControl()

#### getCompareConfiguration

    protected EMFCompareConfiguration getCompareConfiguration()

Overrides:
  `getCompareConfiguration` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`
See Also:
  `ContentMergeViewer.getCompareConfiguration()`

#### flushContent

    protected void flushContent(Object input,
                                org.eclipse.core.runtime.IProgressMonitor monitor)

Overrides:
  `flushContent` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`

#### handlePropertyChangeEvent

    protected void handlePropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent event)

This override uses a `MirrorManager` to intercept switches to the swap preference for controlling the mirror mode. When that preference property changes, `handleMirroredChanged()` is called.

Overrides:
  `handlePropertyChangeEvent` in class `org.eclipse.compare.contentmergeviewer.ContentMergeViewer`

#### handleMirroredChanged

    protected void handleMirroredChanged()

This does the processing