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

# Class AbstractStructuredMergeViewer

java.lang.Object
org.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.impl.AbstractMergeViewer
org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.impl.AbstractStructuredMergeViewer

All Implemented Interfaces:
  `IMergeViewer`, `org.eclipse.jface.viewers.IInputProvider`, `org.eclipse.jface.viewers.IInputSelectionProvider`, `org.eclipse.jface.viewers.ISelectionProvider`

Direct Known Subclasses:
  `AbstractTableOrTreeMergeViewer`

public abstract class AbstractStructuredMergeViewer extends AbstractMergeViewer
A specific `AbstractMergeViewer` for the EMF Compare Editor.

Since:
  4.0

## Nested Class Summary

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

`IMergeViewer.MergeViewerSide`

## Field Summary

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

`WIDGET_DATA_KEY`

## Constructor Summary

Constructors
Constructor
Description
`AbstractStructuredMergeViewer(org.eclipse.swt.widgets.Composite parent, IMergeViewer.MergeViewerSide side, IEMFCompareConfiguration compareConfiguration)`
Default constructor.

## Method Summary

Modifier and Type
Method
Description
`protected org.eclipse.jface.action.IAction`
`createAction(MergeMode mode, Diff diff)`
Creates the action for merging the given diff via the specified mode.
`protected void`
`createContextMenu()`
Creates the context menu for the `structured viewer` adding a `menu listener` that calls `fillContextMenu(IMenuManager)`.
`protected abstract org.eclipse.swt.widgets.Control`
`createControl(org.eclipse.swt.widgets.Composite parent)`
Creates the primary control associated with this viewer.
`protected void`
`fillContextMenu(org.eclipse.jface.action.IMenuManager manager)`
Fills the context menu for the `structured viewer. By default, this determines the merge mode from the {@link #getCompareConfiguration() compare configuration}, and uses the {@link #getDiff() diff} of the {@link #getSelection() selection} to {@link #createAction(MergeMode, Diff) create actions}. The default implementation of {@code createAction} returns {@code null}, in which case no action is {@link IMenuManager#add(IAction) added} to the menu manager.`
`org.eclipse.swt.widgets.Control`
`getControl()`
Returns the primary control associated with this viewer.
`protected Diff`
`getDiff()`
Returns the `diff` associated with the one `IMergeViewerItem` in the viewer's `selection`.
`org.eclipse.jface.viewers.ISelection`
`getSelection()`
`protected abstract org.eclipse.jface.viewers.StructuredViewer`
`getStructuredViewer()`
Returns the wrapped `StructuredViewer`.
`protected void`
`handleDispose(org.eclipse.swt.events.DisposeEvent event)`
`protected abstract void`
`hookDispose()`
`void`
`setContentProvider(org.eclipse.jface.viewers.IContentProvider contentProvider)`
`void`
`setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)`
`void`
`setSelection(org.eclipse.jface.viewers.ISelection selection, boolean reveal)`
Sets a new selection for this viewer and optionally makes it visible.

### Methods inherited from class org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.impl.AbstractMergeViewer

`getCompareConfiguration, getDifferenceFilter, getDifferenceGroupProvider, getEffectiveSide, getSide, handleDifferenceFilterChange, handleDifferenceGroupProviderChange`

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

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

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

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

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

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

### Methods inherited from interface org.eclipse.jface.viewers.IInputProvider

`getInput`

### Methods inherited from interface org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer

`refresh, setInput`

### Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider

`addSelectionChangedListener, removeSelectionChangedListener, setSelection`

## Constructor Details

### AbstractStructuredMergeViewer

public AbstractStructuredMergeViewer(org.eclipse.swt.widgets.Composite parent, IMergeViewer.MergeViewerSide side, IEMFCompareConfiguration compareConfiguration)
Default constructor.

Parameters:
  `parent` - the parent widget.
  `side` - the side of the viewer.
  `compareConfiguration` - the compare configuration object used by this viewer.

## Method Details

### createControl

protected abstract org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
Creates the primary control associated with this viewer.

Parameters:
  `parent` - the parent widget of this viewer.
Returns:
  the created primary control associated with this viewer.

### getStructuredViewer

protected abstract org.eclipse.jface.viewers.StructuredViewer getStructuredViewer()
Returns the wrapped `StructuredViewer`.

Returns:
  the wrapped `StructuredViewer`.

### getControl

public org.eclipse.swt.widgets.Control getControl()
Returns the primary control associated with this viewer.

Specified by:
  `getControl` in interface `IMergeViewer`
Specified by:
  `getControl` in class `org.eclipse.jface.viewers.Viewer`
Returns:
  the SWT control which displays this viewer's content
See Also:
  - `Viewer.getControl()`

### createContextMenu

protected void createContextMenu()
Creates the context menu for the `structured viewer` adding a `menu listener` that calls `fillContextMenu(IMenuManager)`.

### fillContextMenu

protected void fillContextMenu(org.eclipse.jface.action.IMenuManager manager)
Fills the context menu for the `structured viewer. By default, this determines the merge mode from the {@link #getCompareConfiguration() compare configuration}, and uses the {@link #getDiff() diff} of the {@link #getSelection() selection} to {@link #createAction(MergeMode, Diff) create actions}. The default implementation of {@code createAction} returns {@code null}, in which case no action is {@link IMenuManager#add(IAction) added} to the menu manager.`

Parameters:
  `manager` - the menu manager of the `context menu`.
See Also:
  - `getDiff()`
  - `createAction(MergeMode, Diff)`

### getDiff

protected Diff getDiff()
Returns the `diff` associated with the one `IMergeViewerItem` in the viewer's `selection`.

Returns:
  the diff associated with the one `IMergeViewerItem` in the viewer's selection.

### createAction

protected org.eclipse.jface.action.IAction createAction(MergeMode mode, Diff diff)
Creates the action for merging the given diff via the specified mode. By default this returns `null`.

Parameters:
  `mode` - the merge mode.
  `diff` - the diff to be merged.
Returns:
  a new action for merging the given diff via the specified mode.

### handleDispose

protected void handleDispose(org.eclipse.swt.events.DisposeEvent event)
Description copied from class: `AbstractMergeViewer`

Overrides:
  `handleDispose` in class `AbstractMergeViewer`
See Also:
  - `ContentViewer.handleDispose(org.eclipse.swt.events.DisposeEvent)`

### hookDispose

protected abstract void hookDispose()

### getSelection

public org.eclipse.jface.viewers.ISelection getSelection()

Specified by:
  `getSelection` in interface `org.eclipse.jface.viewers.ISelectionProvider`
Specified by:
  `getSelection` in class `org.eclipse.jface.viewers.Viewer`
See Also:
  - `ISelectionProvider.getSelection()`

### setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection selection, boolean reveal)
Sets a new selection for this viewer and optionally makes it visible.

Subclasses must implement this method.

Specified by:
  `setSelection` in interface `IMergeViewer`
Specified by:
  `setSelection` in class `org.eclipse.jface.viewers.Viewer`
Parameters:
  `selection` - the new selection
  `reveal` - `true` if the selection is to be made visible, and `false` otherwise
See Also:
  - `Viewer.setSelection(org.eclipse.jface.viewers.ISelection, boolean)`

### setContentProvider

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

Overrides:
  `setContentProvider` in class `org.eclipse.jface.viewers.ContentViewer`

### setLabelProvider

public void setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)

Overrides:
  `setLabelProvider` in class `org.eclipse.jface.viewers.ContentViewer`