public class DiffTreeViewer extends TreeViewer
IDiffContainer
and IDiffElement
interfaces.
This class may be instantiated; it is not intended to be subclassed outside this package.
IDiffContainer
,
IDiffElement
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
ALL_LEVELS
WIDGET_DATA_KEY
Constructor and Description |
---|
DiffTreeViewer(Composite parent,
CompareConfiguration configuration)
Creates a new viewer under the given SWT parent and with the specified configuration.
|
DiffTreeViewer(Tree tree,
CompareConfiguration configuration)
Creates a new viewer for the given SWT tree control with the specified configuration.
|
Modifier and Type | Method and Description |
---|---|
protected void |
copyOne(ICompareInput node,
boolean leftToRight)
Called to copy one side of the given node to the other.
|
protected void |
copySelected(boolean leftToRight)
Copies one side of all
DiffNode s in the current selection to the other side. |
protected void |
createToolItems(ToolBarManager toolbarManager)
This factory method is called after the viewer's controls have been created.
|
protected boolean |
dontExpand(Object o)
This hook method is called from within
internalExpandToLevel
to control whether a given model node should be expanded or not. |
protected void |
expandSelection()
Expands to infinity all items in the selection.
|
protected void |
fillContextMenu(IMenuManager manager)
This method is called to add actions to the viewer's context menu.
|
protected ResourceBundle |
getBundle()
Returns the resource bundle.
|
CompareConfiguration |
getCompareConfiguration()
Returns the compare configuration of this viewer.
|
String |
getTitle()
Returns the viewer's name.
|
protected void |
handleDispose(DisposeEvent event)
Called on the viewer disposal.
|
protected void |
initialSelection()
This hook method is called from within
inputChanged
after a new input has been set but before any controls are updated. |
protected void |
inputChanged(Object in,
Object oldInput)
Internal hook method called when the input to this viewer is
initially set or subsequently changed.
|
protected void |
internalExpandToLevel(Widget node,
int level)
Overridden to avoid expanding
DiffNode s that shouldn't expand. |
protected void |
navigate(boolean next)
Selects the next (or previous) node of the current selection.
|
protected void |
propertyChange(PropertyChangeEvent event)
Tracks property changes of the configuration object.
|
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
add, add, addSelectionListener, addTreeListener, associate, buildLabel, collapseAll, collapseToLevel, createChildren, createTreeItem, doFindInputItem, doFindItem, doUpdateItem, doUpdateItem, expandAll, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, getChildren, getExpandedElements, getExpandedState, getExpandedTreePaths, getNextItem, getPreviousItem, getSelection, getSelectionFromWidget, getSortedChildren, getTreePathFromItem, getVisibleExpandedElements, handleDoubleSelect, indexForElement, insert, internalCollapseToLevel, internalExpand, internalFindItems, internalGetWidgetToSelect, internalIsInputOrEmptyPath, internalRefresh, internalRefresh, internalRefresh, internalRemove, internalRemove, isSameSelection, labelProviderChanged, remove, remove, remove, removeTreeListener, reveal, scrollDown, scrollUp, setAutoExpandLevel, setExpandedElements, setExpandedState, setExpandedTreePaths, setExpandPreCheckFilters, setSelectionToWidget, setSelectionToWidget, updateChildren
applyEditorValue, cancelEditing, checkBusy, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, hookEditingSupport, isBusy, isCellEditorActive, refresh, refresh, setBusy, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setLabelProvider, triggerEditorActivationEvent, update
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getRoot, getSorter, 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
getContentProvider, getInput
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, setData, setSelection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSelectionChangedListener, removeSelectionChangedListener, setSelection
public DiffTreeViewer(Tree tree, CompareConfiguration configuration)
tree
- the tree controlconfiguration
- the configuration for this viewerpublic DiffTreeViewer(Composite parent, CompareConfiguration configuration)
parent
- the SWT control under which to create the viewerconfiguration
- the configuration for this viewerpublic String getTitle()
protected ResourceBundle getBundle()
public CompareConfiguration getCompareConfiguration()
protected void handleDispose(DisposeEvent event)
handleDispose
in class ColumnViewer
event
- dispose event that triggered call to this methodprotected void propertyChange(PropertyChangeEvent event)
event
- property change event that triggered call to this methodprotected void inputChanged(Object in, Object oldInput)
Viewer
The default implementation does nothing. Subclassers may override this method to do something when a viewer's input is set. A typical use is populate the viewer.
inputChanged
in class AbstractTreeViewer
in
- the new input of this viewer, or null
if noneoldInput
- the old input element or null
if there
was previously no inputprotected void initialSelection()
inputChanged
after a new input has been set but before any controls are updated.
This default implementation calls navigate(true)
to select and expand the first leaf node.
Clients can override this method and are free to decide whether
they want to call the inherited method.protected void internalExpandToLevel(Widget node, int level)
DiffNode
s that shouldn't expand.internalExpandToLevel
in class AbstractTreeViewer
node
- the node to expandlevel
- non-negative level, or ALL_LEVELS
to collapse all levels of the treeprotected boolean dontExpand(Object o)
internalExpandToLevel
to control whether a given model node should be expanded or not.
This default implementation checks whether the object is a DiffNode
and
calls dontExpand()
on it.
Clients can override this method and are free to decide whether
they want to call the inherited method.o
- the model object to be expandedfalse
if a node should be expanded, true
to prevent expandingprotected void createToolItems(ToolBarManager toolbarManager)
ToolBarManager
. Two actions
allow for copying one side of a DiffNode
to the other side.
Two other actions are for navigating from one node to the next (previous).
Clients can override this method and are free to decide whether they want to call the inherited method.
toolbarManager
- the toolbar manager for which to add the actionsprotected void fillContextMenu(IMenuManager manager)
DiffNode
to the other side.
Clients can override this method and are free to decide whether they want to call
the inherited method.manager
- the menu manager for which to add the actionsprotected void expandSelection()
protected void copySelected(boolean leftToRight)
DiffNode
s in the current selection to the other side.
Called from the (internal) actions for copying the sides of a DiffNode
.
Clients may override.leftToRight
- if true
the left side is copied to the right side.
If false
the right side is copied to the left sideprotected void copyOne(ICompareInput node, boolean leftToRight)
ICompareInput.copy(...)
.
Clients may override.node
- the node to copyleftToRight
- if true
the left side is copied to the right side.
If false
the right side is copied to the left sideprotected void navigate(boolean next)
next
- if true
the next node is selected, otherwise the previous node
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.