Class DiffTreeViewer
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.compare.structuremergeviewer.DiffTreeViewer
- All Implemented Interfaces:
- IInputProvider,- IInputSelectionProvider,- IPostSelectionProvider,- ISelectionProvider
- Direct Known Subclasses:
- StructureDiffViewer
A tree viewer that works on objects implementing
 the 
IDiffContainer and IDiffElement interfaces.
 This class may be instantiated; it is not intended to be subclassed outside of this package.
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewerStructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
- 
Field SummaryFields inherited from class org.eclipse.jface.viewers.AbstractTreeViewerALL_LEVELS, NO_EXPANDFields inherited from class org.eclipse.jface.viewers.ViewerWIDGET_DATA_KEY
- 
Constructor SummaryConstructorsConstructorDescriptionDiffTreeViewer(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.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcopyOne(ICompareInput node, boolean leftToRight) Called to copy one side of the given node to the other.protected voidcopySelected(boolean leftToRight) Copies one side of allDiffNodes in the current selection to the other side.protected voidcreateToolItems(ToolBarManager toolbarManager) This factory method is called after the viewer's controls have been created.protected booleandontExpand(Object o) This hook method is called from withininternalExpandToLevelto control whether a given model node should be expanded or not.protected voidExpands to infinity all items in the selection.protected voidfillContextMenu(IMenuManager manager) This method is called to add actions to the viewer's context menu.protected ResourceBundleReturns the resource bundle.Returns the compare configuration of this viewer.getTitle()Returns the viewer's name.protected voidhandleDispose(DisposeEvent event) Called on the viewer disposal.protected voidThis hook method is called from withininputChangedafter a new input has been set but before any controls are updated.protected voidinputChanged(Object in, Object oldInput) Internal hook method called when the input to this viewer is initially set or subsequently changed.protected voidinternalExpandToLevel(Widget node, int level) Overridden to avoid expandingDiffNodes that shouldn't expand.protected voidnavigate(boolean next) Selects the next (or previous) node of the current selection.protected voidTracks property changes of the configuration object.Methods inherited from class org.eclipse.jface.viewers.TreeVieweraddTreeListener, 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, updatePlusMethods inherited from class org.eclipse.jface.viewers.AbstractTreeVieweradd, add, addSelectionListener, addTreeListener, associate, buildLabel, collapseAll, collapseToLevel, contains, createChildren, createTreeItem, doFindInputItem, doFindItem, doUpdateItem, doUpdateItem, expandAll, expandAll, expandToLevel, expandToLevel, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, getAutoExpandOnSingleChildLevels, getChildren, getExpandedElements, getExpandedState, getExpandedTreePaths, getNextItem, getPreviousItem, getSelection, getSelectionFromWidget, getSortedChildren, getStructuredSelection, 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, setAutoExpandOnSingleChildLevels, setExpandedElements, setExpandedState, setExpandedStateWithAutoExpandOnSingleChild, setExpandedTreePaths, setExpandPreCheckFilters, setSelectionToWidget, setSelectionToWidget, updateChildrenMethods inherited from class org.eclipse.jface.viewers.ColumnViewerapplyEditorValue, cancelEditing, checkBusy, firePostSelectionChanged, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, hookEditingSupport, isBusy, isCellEditorActive, isExpandableNode, refresh, refresh, setBusy, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setDisplayIncrementally, setLabelProvider, triggerEditorActivationEvent, unmapAllElements, update, updateSelectionMethods inherited from class org.eclipse.jface.viewers.StructuredVieweraddDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, 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, unmapElement, unmapElement, update, updateItem, usingElementMapMethods inherited from class org.eclipse.jface.viewers.ContentViewergetContentProvider, getInputMethods inherited from class org.eclipse.jface.viewers.VieweraddHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, setData, setSelectionMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.viewers.ISelectionProvideraddSelectionChangedListener, removeSelectionChangedListener, setSelection
- 
Constructor Details- 
DiffTreeViewerCreates a new viewer for the given SWT tree control with the specified configuration.- Parameters:
- tree- the tree control
- configuration- the configuration for this viewer
 
- 
DiffTreeViewerCreates a new viewer under the given SWT parent and with the specified configuration.- Parameters:
- parent- the SWT control under which to create the viewer
- configuration- the configuration for this viewer
 
 
- 
- 
Method Details- 
getTitleReturns the viewer's name.- Returns:
- the viewer's name
 
- 
getBundleReturns the resource bundle.- Returns:
- the viewer's resource bundle
 
- 
getCompareConfigurationReturns the compare configuration of this viewer.- Returns:
- the compare configuration of this viewer
 
- 
handleDisposeCalled on the viewer disposal. Unregisters from the compare configuration. Clients may extend if they have to do additional cleanup.- Overrides:
- handleDisposein class- ColumnViewer
- Parameters:
- event- dispose event that triggered call to this method
 
- 
propertyChangeTracks property changes of the configuration object. Clients may extend to track their own property changes. In this case they must call the inherited method.- Parameters:
- event- property change event that triggered call to this method
 
- 
inputChangedDescription copied from class:ViewerInternal hook method called when the input to this viewer is initially set or subsequently changed.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. - Overrides:
- inputChangedin class- AbstractTreeViewer
- Parameters:
- in- the new input of this viewer, or- nullif none
- oldInput- the old input element or- nullif there was previously no input
 
- 
initialSelectionprotected void initialSelection()This hook method is called from withininputChangedafter a new input has been set but before any controls are updated. This default implementation callsnavigate(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.- Since:
- 2.0
 
- 
internalExpandToLevelOverridden to avoid expandingDiffNodes that shouldn't expand.- Overrides:
- internalExpandToLevelin class- AbstractTreeViewer
- Parameters:
- node- the node to expand
- level- non-negative level, or- ALL_LEVELSto collapse all levels of the tree
 
- 
dontExpandThis hook method is called from withininternalExpandToLevelto control whether a given model node should be expanded or not. This default implementation checks whether the object is aDiffNodeand callsdontExpand()on it. Clients can override this method and are free to decide whether they want to call the inherited method.- Parameters:
- o- the model object to be expanded
- Returns:
- falseif a node should be expanded,- trueto prevent expanding
- Since:
- 2.0
 
- 
createToolItemsThis factory method is called after the viewer's controls have been created. It installs four actions in the givenToolBarManager. Two actions allow for copying one side of aDiffNodeto 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. - Parameters:
- toolbarManager- the toolbar manager for which to add the actions
 
- 
fillContextMenuThis method is called to add actions to the viewer's context menu. It installs actions for expanding tree nodes, copying one side of aDiffNodeto the other side. Clients can override this method and are free to decide whether they want to call the inherited method.- Parameters:
- manager- the menu manager for which to add the actions
 
- 
expandSelectionprotected void expandSelection()Expands to infinity all items in the selection.- Since:
- 2.0
 
- 
copySelectedprotected void copySelected(boolean leftToRight) Copies one side of allDiffNodes in the current selection to the other side. Called from the (internal) actions for copying the sides of aDiffNode. Clients may override.- Parameters:
- leftToRight- if- truethe left side is copied to the right side. If- falsethe right side is copied to the left side
 
- 
copyOneCalled to copy one side of the given node to the other. This default implementation delegates the call toICompareInput.copy(...). Clients may override.- Parameters:
- node- the node to copy
- leftToRight- if- truethe left side is copied to the right side. If- falsethe right side is copied to the left side
 
 
-