Package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer

# Class EMFCompareStructureMergeViewer

java.lang.Object
org.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.jface.viewers.StructuredViewer
org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.AbstractStructuredViewerWrapper<org.eclipse.swt.custom.CTabFolder,WrappableTreeViewer>
org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.EMFCompareStructureMergeViewer

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

public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrapper<org.eclipse.swt.custom.CTabFolder,WrappableTreeViewer> implements CommandStackListener
Implementation of `AbstractStructuredViewerWrapper`.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.AbstractStructuredViewerWrapper

`AbstractStructuredViewerWrapper.ControlAndViewer<C extends org.eclipse.swt.widgets.Control,V extends org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.IWrappableStructuredViewer>`

## Nested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewer

`org.eclipse.jface.viewers.StructuredViewer.ColorAndFontCollector, org.eclipse.jface.viewers.StructuredViewer.ColorAndFontCollectorWithProviders`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected org.eclipse.jface.viewers.ISelection`
`currentSelection`
The current selection.
`protected org.eclipse.jface.util.IPropertyChangeListener`
`preferenceChangeListener`
Listener reacting to changes in the `preferenceStore`.
`protected final org.eclipse.jface.preference.IPreferenceStore`
`preferenceStore`
Preference store holding UI-related settings for this viewer.

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

`WIDGET_DATA_KEY`

## Constructor Summary

Constructors
Constructor
Description
`EMFCompareStructureMergeViewer(org.eclipse.swt.widgets.Composite parent, EMFCompareConfiguration config)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)`
`protected void`
`clearHighlightRelatedChanges()`
Clears the highlighting of related changes for the current selection.
`void`
`colorChanged(IColorChangeEvent changeColorEvent)`
`void`
`commandStackChanged(EventObject event)`
`protected void`
`compareInputChanged(org.eclipse.compare.structuremergeviewer.ICompareInput input)`
Triggered by fCompareInputChangeListener and `inputChanged(Object, Object)`.
`protected void`
`compareInputChanged(org.eclipse.compare.structuremergeviewer.ICompareInput input, org.eclipse.core.runtime.IProgressMonitor monitor)`
`protected void`
`compareInputChanged(Comparison input, org.eclipse.core.runtime.IProgressMonitor monitor)`
`protected void`
`compareInputChanged(ComparisonScopeInput input, org.eclipse.core.runtime.IProgressMonitor monitor)`
`protected void`
`compareInputChanged(IComparisonScope scope, Comparison comparison, org.eclipse.core.runtime.IProgressMonitor monitor)`
`protected void`
`compareInputChangedToNull()`
`protected AbstractStructuredViewerWrapper.ControlAndViewer<org.eclipse.swt.custom.CTabFolder,WrappableTreeViewer>`
`createControlAndViewer(org.eclipse.swt.widgets.Composite parent)`
Should call
invalid reference

    #setViewer(org.eclipse.jface.viewers.Viewer)

.
`protected CompareToolBar`
`createToolBar(org.eclipse.jface.action.ToolBarManager manager)`
`protected void`
`disposeResourceSet(ResourceSet resourceSet)`
Disposes the `ResourceSet`.
`protected void`
`disposeResourceSets(Comparison comparison)`
`protected void`
`enableToolbar(org.eclipse.core.runtime.IProgressMonitor monitor)`
`protected void`
`expandTreeToLevel(int level, long timeout)`
Expands the `tree viewer` to the given level for at most the given number of milliseconds.
`protected void`
`fireSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)`
`EMFCompareStructureMergeViewerContentProvider`
`getContentProvider()`
`protected int`
`getDefaultTreeExpansionLevel()`
Returns the default expansion level for the tree viewer.
`org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider`
`getLabelProvider()`
`Navigatable`
`getNavigatable()`
Returns the `Navigatable` for this structure merge viewer.
`protected CompareToolBar`
`getToolBar()`
Returns the toolbar for this Structure merge viewer.
`protected long`
`getTreeExpandTimeout()`
Returns the timeout limit for the number of seconds spent expanding the tree viewer.
`org.eclipse.jface.viewers.TreeViewer`
`getTreeViewer()`
Returns the tree viewer.
`void`
`handleDifferenceFilterChange(IDifferenceFilterChange event)`
`void`
`handleDifferenceGroupProviderChange(IDifferenceGroupProviderChange event)`
`protected void`
`handleDispose(org.eclipse.swt.events.DisposeEvent event)`
`void`
`handleEditingDomainChange(ICompareEditingDomainChange event)`
`protected void`
`handlePreferenceChangedEvent(org.eclipse.jface.util.PropertyChangeEvent event)`
Handles changes to the UI-related preferences in the `preferenceStore`.
`protected void`
`hookAdapters(org.eclipse.compare.structuremergeviewer.ICompareInput input, Comparison compareResult)`
Hooks the adapters required for handling UI properly.
`protected ComposedAdapterFactory`
`initAdapterFactory(Comparison comparison)`
Creates a new adapter factory based on the current compare configuration.
`protected void`
`initToolbar(org.eclipse.core.runtime.IProgressMonitor monitor)`
The tool bar must be init after we know the editable state of left and right input.
`protected void`
`inputChanged(Object input, Object oldInput)`
`protected void`
`internalRefresh(Object element)`
`protected boolean`
`isHighlightRelatedChanges()`
Returns whether we highlight changes related to the current selected change.
`protected boolean`
`isSelectFirstChange()`
Returns whether the first change should be selected automatically after initialization.
`void`
`mergePreviewModeChange(IMergePreviewModeChange event)`
`protected void`
`preHookCreateControlAndViewer()`
`void`
`refresh()`
`void`
`removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)`
`protected void`
`selectFirstDiffOrDisplayLabelViewer(Comparison comparison)`
Select the first difference...if there are differences, otherwise, display appropriate content viewer (no differences or no visible differences)
`protected void`
`stopJob(org.eclipse.core.runtime.jobs.Job job)`
`protected void`
`updateHighlightRelatedChanges(org.eclipse.jface.viewers.ISelection selection)`
Updates the highlighting of related changes for the current selection, if it is `enabled`.

### Methods inherited from class org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.AbstractStructuredViewerWrapper

`addDragSupport, addDropSupport, addFilter, doFindInputItem, doFindItem, doUpdateItem, getComparator, getCompareConfiguration, getComparer, getControl, getFilters, getSelectionFromWidget, getSorter, getViewer, handleInvalidSelection, removeFilter, resetFilters, reveal, setComparator, setComparer, setContentProvider, setFilters, setLabelProvider, setSelectionToWidget, setSorter, setUseHashlookup`

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

`addDoubleClickListener, addOpenListener, addPostSelectionChangedListener, assertContentProviderType, assertElementsNotNull, associate, buildLabel, disassociate, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getFilteredChildren, getItem, getRawChildren, getRoot, getSelection, getSortedChildren, getStructuredSelection, handleDoubleSelect, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, hookControl, internalRefresh, internalUpdate, mapElement, needsRefilter, preservingSelection, refresh, refresh, refresh, refreshItem, removeDoubleClickListener, removeOpenListener, removePostSelectionChangedListener, setInput, setSelection, setSelectionToWidget, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, update, updateItem, updateSelection, usingElementMap`

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

`getInput, labelProviderChanged`

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

`addHelpListener, fireHelpRequested, getData, handleHelpRequest, removeHelpListener, 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.ISelectionProvider

`setSelection`

## Field Details

### preferenceStore

protected final org.eclipse.jface.preference.IPreferenceStore preferenceStore
Preference store holding UI-related settings for this viewer.

### currentSelection

protected org.eclipse.jface.viewers.ISelection currentSelection
The current selection.

### preferenceChangeListener

protected org.eclipse.jface.util.IPropertyChangeListener preferenceChangeListener
Listener reacting to changes in the `preferenceStore`.

## Constructor Details

### EMFCompareStructureMergeViewer

public EMFCompareStructureMergeViewer(org.eclipse.swt.widgets.Composite parent, EMFCompareConfiguration config)
Constructor.

Parameters:
  `parent` - the SWT parent control under which to create the viewer's SWT control.
  `config` - a compare configuration the newly created viewer might want to use.

## Method Details

### createToolBar

protected CompareToolBar createToolBar(org.eclipse.jface.action.ToolBarManager manager)

### initToolbar

protected void initToolbar(org.eclipse.core.runtime.IProgressMonitor monitor)
The tool bar must be init after we know the editable state of left and right input.

See Also:
  - `compareInputChanged(ICompareInput, IProgressMonitor)`

### enableToolbar

protected void enableToolbar(org.eclipse.core.runtime.IProgressMonitor monitor)

### getToolBar

protected CompareToolBar getToolBar()
Returns the toolbar for this Structure merge viewer.

Returns:
  The `CompareToolBar`.

### getNavigatable

public Navigatable getNavigatable()
Returns the `Navigatable` for this structure merge viewer.

Returns:
  The `Navigatable`.

### preHookCreateControlAndViewer

protected void preHookCreateControlAndViewer()

Overrides:
  `preHookCreateControlAndViewer` in class `AbstractStructuredViewerWrapper<org.eclipse.swt.custom.CTabFolder,WrappableTreeViewer>`
See Also:
  - invalid reference

        org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.AbstractViewerWrapper#preHookCreateControlAndViewer()

### initAdapterFactory

protected ComposedAdapterFactory initAdapterFactory(Comparison comparison)
Creates a new adapter factory based on the current compare configuration.

Returns:
  adapter factory

### colorChanged

public void colorChanged(IColorChangeEvent changeColorEvent)

### createControlAndViewer

protected AbstractStructuredViewerWrapper.ControlAndViewer<org.eclipse.swt.custom.CTabFolder,WrappableTreeViewer> createControlAndViewer(org.eclipse.swt.widgets.Composite parent)
Should call
invalid reference

    #setViewer(org.eclipse.jface.viewers.Viewer)

.

Specified by:
  `createControlAndViewer` in class `AbstractStructuredViewerWrapper<org.eclipse.swt.custom.CTabFolder,WrappableTreeViewer>`
Parameters:
  `parent` - the SWT control under which to create the viewer.
Returns:
  a composite control that will contains all sub-control of this wrapper.

### getTreeViewer

public org.eclipse.jface.viewers.TreeViewer getTreeViewer()
Returns the tree viewer.

Returns:
  the tree viewer

### getContentProvider

public EMFCompareStructureMergeViewerContentProvider getContentProvider()

Overrides:
  `getContentProvider` in class `org.eclipse.jface.viewers.ContentViewer`
See Also:
  - `ContentViewer.getContentProvider()`

### getLabelProvider

public org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider getLabelProvider()

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

### handleEditingDomainChange

public void handleEditingDomainChange(ICompareEditingDomainChange event)

### mergePreviewModeChange

public void mergePreviewModeChange(IMergePreviewModeChange event)

### handleDifferenceFilterChange

public void handleDifferenceFilterChange(IDifferenceFilterChange event)

### refresh

public void refresh()

Overrides:
  `refresh` in class `org.eclipse.jface.viewers.StructuredViewer`

### handleDifferenceGroupProviderChange

public void handleDifferenceGroupProviderChange(IDifferenceGroupProviderChange event)

### inputChanged

protected void inputChanged(Object input, Object oldInput)

Overrides:
  `inputChanged` in class `org.eclipse.jface.viewers.Viewer`
See Also:
  - `Viewer.inputChanged(Object, Object)`

### handleDispose

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

Overrides:
  `handleDispose` in class `AbstractStructuredViewerWrapper<org.eclipse.swt.custom.CTabFolder,WrappableTreeViewer>`
See Also:
  - invalid reference

        org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.AbstractViewerWrapper#handleDispose(DisposeEvent)

### commandStackChanged

public void commandStackChanged(EventObject event)

Specified by:
  `commandStackChanged` in interface `CommandStackListener`
See Also:
  - `CommandStackListener.commandStackChanged(java.util.EventObject)`

### compareInputChanged

protected void compareInputChanged(org.eclipse.compare.structuremergeviewer.ICompareInput input)
Triggered by fCompareInputChangeListener and `inputChanged(Object, Object)`.

### compareInputChanged

protected void compareInputChanged(Comparison input, org.eclipse.core.runtime.IProgressMonitor monitor)

### compareInputChanged

protected void compareInputChanged(ComparisonScopeInput input, org.eclipse.core.runtime.IProgressMonitor monitor)

### compareInputChanged

protected void compareInputChanged(IComparisonScope scope, Comparison comparison, org.eclipse.core.runtime.IProgressMonitor monitor)

### compareInputChanged

protected void compareInputChanged(org.eclipse.compare.structuremergeviewer.ICompareInput input, org.eclipse.core.runtime.IProgressMonitor monitor)

### hookAdapters

protected void hookAdapters(org.eclipse.compare.structuremergeviewer.ICompareInput input, Comparison compareResult)
Hooks the adapters required for handling UI properly.

Parameters:
  `input` -
  `compareResult` -

### isSelectFirstChange

protected boolean isSelectFirstChange()
Returns whether the first change should be selected automatically after initialization.

Returns:
  true if the first change should be selected automatically, false otherwise.
See Also:
  - `selectFirstDiffOrDisplayLabelViewer(Comparison)`

### getDefaultTreeExpansionLevel

protected int getDefaultTreeExpansionLevel()
Returns the default expansion level for the tree viewer.

Returns:
  non-negative level, or `ALL_LEVELS` to expand all levels of the tree
See Also:
  - `expandTreeToLevel(int, long)`

### getTreeExpandTimeout

protected long getTreeExpandTimeout()
Returns the timeout limit for the number of seconds spent expanding the tree viewer.

Returns:
  the maximum number of seconds to spend on expanding the tree viewer.
See Also:
  - `expandTreeToLevel(int, long)`

### expandTreeToLevel

protected void expandTreeToLevel(int level, long timeout)
Expands the `tree viewer` to the given level for at most the given number of milliseconds.

Parameters:
  `level` - non-negative level, or `ALL_LEVELS` to expand all levels of the tree
  `timeout` - the maximum number of milliseconds to spend on expanding the tree.
See Also:
  - `AbstractTreeViewer.expandToLevel(int)`

### isHighlightRelatedChanges

protected boolean isHighlightRelatedChanges()
Returns whether we highlight changes related to the current selected change.

Returns:
  true if we highlight related changes, false otherwise.
See Also:
  - `updateHighlightRelatedChanges(ISelection)`

### updateHighlightRelatedChanges

protected void updateHighlightRelatedChanges(org.eclipse.jface.viewers.ISelection selection)
Updates the highlighting of related changes for the current selection, if it is `enabled`.

Parameters:
  `selection` - selection

### clearHighlightRelatedChanges

protected void clearHighlightRelatedChanges()
Clears the highlighting of related changes for the current selection.

### selectFirstDiffOrDisplayLabelViewer

protected void selectFirstDiffOrDisplayLabelViewer(Comparison comparison)
Select the first difference...if there are differences, otherwise, display appropriate content viewer (no differences or no visible differences)

Parameters:
  `comparison` - the comparison used to know if there are differences.

### compareInputChangedToNull

protected void compareInputChangedToNull()

### stopJob

protected void stopJob(org.eclipse.core.runtime.jobs.Job job)

### disposeResourceSets

protected void disposeResourceSets(Comparison comparison)

### disposeResourceSet

protected void disposeResourceSet(ResourceSet resourceSet)
Disposes the `ResourceSet`.

Parameters:
  `resourceSet` - that need to be disposed.

### internalRefresh

protected void internalRefresh(Object element)

Specified by:
  `internalRefresh` in class `org.eclipse.jface.viewers.StructuredViewer`
See Also:
  - `StructuredViewer.internalRefresh(java.lang.Object)`

### handlePreferenceChangedEvent

protected void handlePreferenceChangedEvent(org.eclipse.jface.util.PropertyChangeEvent event)
Handles changes to the UI-related preferences in the `preferenceStore`.

Parameters:
  `event` - change event for a preference property

### addSelectionChangedListener

public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)

Specified by:
  `addSelectionChangedListener` in interface `org.eclipse.jface.viewers.ISelectionProvider`
Overrides:
  `addSelectionChangedListener` in class `org.eclipse.jface.viewers.Viewer`

### removeSelectionChangedListener

public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)

Specified by:
  `removeSelectionChangedListener` in interface `org.eclipse.jface.viewers.ISelectionProvider`
Overrides:
  `removeSelectionChangedListener` in class `org.eclipse.jface.viewers.Viewer`

### fireSelectionChanged

protected void fireSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)

Overrides:
  `fireSelectionChanged` in class `org.eclipse.jface.viewers.Viewer`