## org.eclipse.emf.compare.ui.viewer.content.part.diff
Class ModelContentMergeDiffTab

    java.lang.Object
      org.eclipse.jface.viewers.Viewer
          org.eclipse.jface.viewers.ContentViewer
              org.eclipse.jface.viewers.StructuredViewer
                  org.eclipse.jface.viewers.ColumnViewer
                      org.eclipse.jface.viewers.AbstractTreeViewer
                          org.eclipse.jface.viewers.TreeViewer
                              org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab

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

    public class ModelContentMergeDiffTab

extends org.eclipse.jface.viewers.TreeViewer
implements IModelContentMergeViewerTab

Represents the tree view under a `ModelContentMergeTabFolder`'s diff tab.

Nested Class Summary

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
`protected boolean` `needsRedraw` Tells the tree viewer it needs to be redrawn.
`protected ModelContentMergeTabFolder` `parent` Keeps a reference to the containing tab folder.
`protected int` `partSide` `int` representing this viewer part side.
`protected java.util.List<org.eclipse.swt.widgets.Item>` `visibleItems` Caches visible elements.

Fields inherited from class org.eclipse.jface.viewers.AbstractTreeViewer
`ALL_LEVELS`

Fields inherited from class org.eclipse.jface.viewers.Viewer
`WIDGET_DATA_KEY`

Constructor Summary
`ModelContentMergeDiffTab(org.eclipse.swt.widgets.Composite parentComposite, int side, ModelContentMergeTabFolder parentFolder)` Creates a tree viewer under the given parent control.

Method Summary
`protected void` `clearCaches()` Invalidates all caches of the tab.
`void` `dispose()` Disposes of all resources allocated this tab.
`protected org.eclipse.swt.widgets.Widget` `doFindInputItem(java.lang.Object element)`
`java.util.List<org.eclipse.swt.widgets.TreeItem>` `getSelectedElements()` Returns a `List` of the selected elements.
`protected org.eclipse.jface.viewers.TreePath` `getTreePathFromItem(org.eclipse.swt.widgets.Item item)` Overriden to cache the result.
`ModelContentMergeTabItem` `getUIItem(org.eclipse.emf.ecore.EObject data)` This will be used when drawing the center part's marquees.
`java.util.List<ModelContentMergeTabItem>` `getVisibleElements()` Returns a list of all the `tree`'s visible elements.
`protected void` `inputChanged(java.lang.Object input, java.lang.Object oldInput)`
`void` `redraw()` Redraws the Control displayed by the tab.
`void` `refresh(java.lang.Object element, boolean updateLabels)`
`void` `setReflectiveInput(java.lang.Object object)` Sets the input of the tab.
`protected void` `setSelectionToWidget(java.util.List l, boolean reveal)`
`protected void` `setupCaches()` Sets up all necessary caches for navigation through the differences shown by this tab.
`void` `showItems(java.util.List<DiffElement> items)` Ensures the first element of the given list of items is visible in the tree, and sets the tree's selection to this list.

Methods inherited from class org.eclipse.jface.viewers.TreeViewer

`addTreeListener, assertContentProviderType, createViewerEditor, disassociate, doGetColumnCount, editElement, getChild, getChildren, getColumnViewerOwner, getControl, getExpanded, getItemAt, getItemCount, getItemCount, getItems, getLabelProvider, getParentElement, getParentItem, getRawChildren, getSelection, getTree, getViewerRowFromItem, handleTreeCollapse, handleTreeExpand, hookControl, internalAdd, internalInitializeTree, internalRefreshStruct, isExpandable, mapElement, newItem, remove, removeAll, replace, setChildCount, setContentProvider, setExpanded, setHasChildren, setSelection, setSelection, showItem, updatePlus`

Methods inherited from class org.eclipse.jface.viewers.AbstractTreeViewer

`add, add, addSelectionListener, addTreeListener, associate, buildLabel, collapseAll, collapseToLevel, createChildren, createTreeItem, doFindItem, doUpdateItem, doUpdateItem, expandAll, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, getChildren, getExpandedElements, getExpandedState, getExpandedTreePaths, getNextItem, getPreviousItem, getSelection, getSelectionFromWidget, getSortedChildren, getVisibleExpandedElements, handleDoubleSelect, indexForElement, insert, internalCollapseToLevel, internalExpand, internalExpandToLevel, internalFindItems, internalGetWidgetToSelect, internalIsInputOrEmptyPath, internalRefresh, internalRefresh, internalRefresh, internalRemove, internalRemove, isSameSelection, labelProviderChanged, remove, remove, remove, removeTreeListener, reveal, scrollDown, scrollUp, setAutoExpandLevel, setExpandedElements, setExpandedState, setExpandedTreePaths, setSelectionToWidget, updateChildren`

Methods inherited from class org.eclipse.jface.viewers.ColumnViewer
`applyEditorValue, cancelEditing, checkBusy, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, hookEditingSupport, isBusy, isCellEditorActive, refresh, setBusy, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setLabelProvider, triggerEditorActivationEvent, update`

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

`addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getRoot, getSorter, handleDispose, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, internalUpdate, needsRefilter, preservingSelection, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setFilters, setInput, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, updateItem, updateSelection, usingElementMap`

Methods inherited from class org.eclipse.jface.viewers.ContentViewer
`getContentProvider, getInput`

Methods inherited from class org.eclipse.jface.viewers.Viewer
`addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, 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.emf.compare.ui.viewer.content.part.IModelContentMergeViewerTab
`addSelectionChangedListener, getControl`

Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
`addSelectionChangedListener, removeSelectionChangedListener, setSelection`

Field Detail

### needsRedraw

    protected boolean needsRedraw

  Tells the tree viewer it needs to be redrawn.

### partSide

    protected final int partSide

  `int` representing this viewer part side.

### visibleItems

    protected final java.util.List<org.eclipse.swt.widgets.Item> visibleItems

  Caches visible elements.

### parent

    protected final ModelContentMergeTabFolder parent

  Keeps a reference to the containing tab folder.

  Since:
    1.1

Constructor Detail

### ModelContentMergeDiffTab

    public ModelContentMergeDiffTab(org.eclipse.swt.widgets.Composite parentComposite,
                                    int side,
                                    ModelContentMergeTabFolder parentFolder)

  Creates a tree viewer under the given parent control.

  Parameters:
    `parentComposite` - The parent `Composite` for this tree viewer.
    `side` - Side of this viewer part.
    `parentFolder` - Parent folder of this tab.

Method Detail

### dispose

    public void dispose()

  Disposes of all resources allocated this tab.

  Specified by:
    `dispose` in interface `IModelContentMergeViewerTab`
  See Also:
    `IModelContentMergeViewerTab.dispose()`

### getSelectedElements

    public java.util.List<org.eclipse.swt.widgets.TreeItem> getSelectedElements()

  Returns a `List` of the selected elements.

  Specified by:
    `getSelectedElements` in interface `IModelContentMergeViewerTab`
  Returns:
    `List` of the selected elements.

### getUIItem

    public ModelContentMergeTabItem getUIItem(org.eclipse.emf.ecore.EObject data)

  This will be used when drawing the center part's marquees.

  Specified by:
    `getUIItem` in interface `IModelContentMergeViewerTab`
  Parameters:
    `data` - The data for which we need UI variables for.
  Returns:
    List of items corresponding to the given data, wrapped along with UI information.
  See Also:
    `IModelContentMergeViewerTab.getUIItem(org.eclipse.emf.ecore.EObject)`

### getVisibleElements

    public java.util.List<ModelContentMergeTabItem> getVisibleElements()

  Returns a list of all the `tree`'s visible elements.

  Specified by:
    `getVisibleElements` in interface `IModelContentMergeViewerTab`
  Returns:
    List containing all the `tree`'s visible elements.

### redraw

    public void redraw()

  Redraws the Control displayed by the tab.

  Specified by:
    `redraw` in interface `IModelContentMergeViewerTab`
  See Also:
    `IModelContentMergeViewerTab.redraw()`

### refresh

    public void refresh(java.lang.Object element,
                        boolean updateLabels)

  Overrides:
    `refresh` in class `org.eclipse.jface.viewers.ColumnViewer`
  See Also:
    `ColumnViewer.refresh(java.lang.Object, boolean)`

### setReflectiveInput

    public void setReflectiveInput(java.lang.Object object)

  Sets the input of the tab.

  This is often implemented by redirecting to the tab's "setInput(Object)" method.

  Specified by:
    `setReflectiveInput` in interface `IModelContentMergeViewerTab`
  Parameters:
    `object` - New input of the tab's viewer.
  See Also:
    `IModelContentMergeViewerTab.setReflectiveInput(java.lang.Object)`

### showItems

    public void showItems(java.util.List<DiffElement> items)

  Ensures the first element of the given list of items is visible in the tree, and sets the tree's selection to this list.

  Specified by:
    `showItems` in interface `IModelContentMergeViewerTab`
  Parameters:
    `items` - Items to make visible.

### clearCaches

    protected final void clearCaches()

  Invalidates all caches of the tab.

### doFindInputItem

    protected org.eclipse.swt.widgets.Widget doFindInputItem(java.lang.Object element)

  Overrides:
    `doFindInputItem` in class `org.eclipse.jface.viewers.AbstractTreeViewer`
  See Also:
    `AbstractTreeViewer.doFindItem(java.lang.Object)`

### getTreePathFromItem

    protected org.eclipse.jface.viewers.TreePath getTreePathFromItem(org.eclipse.swt.widgets.Item item)

  Overriden to cache the result.

  Overrides:
    `getTreePathFromItem` in class `org.eclipse.jface.viewers.AbstractTreeViewer`
  Parameters:
    `item` - The item we seek the TreePath of.
  Returns:
    `TreePath` of the given item.

### inputChanged

    protected void inputChanged(java.lang.Object input,
                                java.lang.Object oldInput)

  Overrides:
    `inputChanged` in class `org.eclipse.jface.viewers.AbstractTreeViewer`
  See Also:
    `AbstractTreeViewer.inputChanged(java.lang.Object, java.lang.Object)`

### setSelectionToWidget

    protected void setSelectionToWidget(java.util.List l,
                                        boolean reveal)

  Overrides:
    `setSelectionToWidget` in class `org.eclipse.jface.viewers.AbstractTreeViewer`
  See Also:
    `StructuredViewer.setSelectionToWidget(List, boolean)`

### setupCaches

    protected final void setupCaches()

  Sets up all necessary caches for navigation through the differences shown by this tab. This must be called at input setting.

Copyright 2006 IBM Corporation and others. All Rights Reserved.