Class StructureDiffViewer
- All Implemented Interfaces:
IInputProvider
,IInputSelectionProvider
,IPostSelectionProvider
,ISelectionProvider
IStructureCreator
to retrieve a hierarchical structure from the input object (an ICompareInput
)
and perform a two-way or three-way compare on it.
This class may be instantiated; it is not intended to be subclassed outside this package.
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewer
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
-
Field Summary
Fields inherited from class org.eclipse.jface.viewers.AbstractTreeViewer
ALL_LEVELS, NO_EXPAND
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
-
Constructor Summary
ConstructorDescriptionStructureDiffViewer
(Composite parent, CompareConfiguration configuration) Creates a new viewer under the given SWT parent with the specified configuration.StructureDiffViewer
(Tree tree, CompareConfiguration configuration) Creates a new viewer for the given SWT tree control with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
compareInputChanged
(ICompareInput input) Recreates the comparable structures for the input sides.protected void
contentChanged
(IContentChangeNotifier changed) Callsdiff
whenever the byte contents changes.protected void
copySelected
(boolean leftToRight) Overridden to call thesave
method on the structure creator after nodes have been copied from one side to the other side of an input object.protected void
diff()
Runs the difference engine and refreshes the tree.protected void
diff
(IProgressMonitor monitor) Runs the difference engine and refreshes the tree.protected Object
getRoot()
Overridden because the input of this viewer is not identical to the root of the tree.Returns the structure creator ornull
if no structure creator has been set withsetStructureCreator
.getTitle()
Reimplemented to get the descriptive title for this viewer from theIStructureCreator
.protected void
handleDispose
(DisposeEvent event) Called on the viewer disposal.protected void
This hook method is called from withininputChanged
after a new input has been set but before any controls are updated.protected void
inputChanged
(Object input, Object oldInput) Internal hook method called when the input to this viewer is initially set or subsequently changed.protected void
postDiffHook
(Differencer differencer, IDiffContainer root) Deprecated.protected void
postDiffHook
(Differencer differencer, IDiffContainer root, IProgressMonitor monitor) This method is called from withindiff(IProgressMonitor)
after the difference tree has been built.protected void
preDiffHook
(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) Deprecated.Clients should overridepreDiffHook(IStructureComparator, IStructureComparator, IStructureComparator, IProgressMonitor)
protected void
preDiffHook
(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right, IProgressMonitor monitor) This method is called from withindiff(IProgressMonitor)
before the difference tree is being built.protected void
Tracks property changes of the configuration object.void
setStructureCreator
(IStructureCreator structureCreator) Configures theStructureDiffViewer
with a structure creator.Methods inherited from class org.eclipse.compare.structuremergeviewer.DiffTreeViewer
copyOne, createToolItems, dontExpand, expandSelection, fillContextMenu, getBundle, getCompareConfiguration, internalExpandToLevel, navigate
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, 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, updateChildren
Methods inherited from class org.eclipse.jface.viewers.ColumnViewer
applyEditorValue, 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, updateSelection
Methods inherited from class org.eclipse.jface.viewers.StructuredViewer
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, 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, 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.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
-
Constructor Details
-
StructureDiffViewer
Creates a new viewer for the given SWT tree control with the specified configuration.- Parameters:
tree
- the tree controlconfiguration
- the configuration for this viewer
-
StructureDiffViewer
Creates a new viewer under the given SWT parent with the specified configuration.- Parameters:
parent
- the SWT control under which to create the viewerconfiguration
- the configuration for this viewer
-
-
Method Details
-
setStructureCreator
Configures theStructureDiffViewer
with a structure creator. The structure creator is used to create a hierarchical structure for each side of the viewer's input element of typeICompareInput
.- Parameters:
structureCreator
- the new structure creator
-
getStructureCreator
Returns the structure creator ornull
if no structure creator has been set withsetStructureCreator
.- Returns:
- the structure creator or
null
-
getTitle
Reimplemented to get the descriptive title for this viewer from theIStructureCreator
.- Overrides:
getTitle
in classDiffTreeViewer
- Returns:
- the viewer's name
-
getRoot
Overridden because the input of this viewer is not identical to the root of the tree. The tree's root is a IDiffContainer that was returned from the methoddiff
.- Overrides:
getRoot
in classStructuredViewer
- Returns:
- the root of the diff tree produced by method
diff
-
inputChanged
Description copied from class:Viewer
Internal 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:
inputChanged
in classDiffTreeViewer
- Parameters:
input
- the new input of this viewer, ornull
if noneoldInput
- the old input element ornull
if there was previously no input
-
initialSelection
protected void initialSelection()Description copied from class:DiffTreeViewer
This hook method is called from withininputChanged
after 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.- Overrides:
initialSelection
in classDiffTreeViewer
-
handleDispose
Description copied from class:DiffTreeViewer
Called on the viewer disposal. Unregisters from the compare configuration. Clients may extend if they have to do additional cleanup.- Overrides:
handleDispose
in classDiffTreeViewer
- Parameters:
event
- dispose event that triggered call to this method
-
compareInputChanged
Recreates the comparable structures for the input sides.- Parameters:
input
- this viewer's new input
-
contentChanged
Callsdiff
whenever the byte contents changes.- Parameters:
changed
- the object that sent out the notification
-
preDiffHook
@Deprecated protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) Deprecated.Clients should overridepreDiffHook(IStructureComparator, IStructureComparator, IStructureComparator, IProgressMonitor)
This method is called from withindiff()
before the difference tree is being built. Clients may override this method to perform their own pre-processing. This default implementation does nothing.- Parameters:
ancestor
- the ancestor input to the differencing operationleft
- the left input to the differencing operationright
- the right input to the differencing operation- Since:
- 2.0
-
preDiffHook
protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right, IProgressMonitor monitor) This method is called from withindiff(IProgressMonitor)
before the difference tree is being built. This method may be called from a background (non-UI) thread).For backwards compatibility, this default implementation calls
preDiffHook(IStructureComparator, IStructureComparator, IStructureComparator)
from the UI thread. Clients should override this method even if they don't perform pre-processing to avoid the call to the UI thread.- Parameters:
ancestor
- the ancestor input to the differencing operationleft
- the left input to the differencing operationright
- the right input to the differencing operationmonitor
- a progress monitor or null if progress is not required- Since:
- 3.3
-
diff
Runs the difference engine and refreshes the tree. This method may be called from a background (non-UI) thread).- Parameters:
monitor
- a progress monitor ornull
if progress in not required
-
diff
protected void diff()Runs the difference engine and refreshes the tree. -
postDiffHook
Deprecated.Subclasses should overridepostDiffHook(Differencer, IDiffContainer, IProgressMonitor)
insteadThis method is called from withindiff()
after the difference tree has been built. Clients may override this method to perform their own post-processing. This default implementation does nothing.- Parameters:
differencer
- the differencer used to perform the differencingroot
- the non-null
root node of the difference tree- Since:
- 2.0
-
postDiffHook
This method is called from withindiff(IProgressMonitor)
after the difference tree has been built. This method may be called from a background (non-UI) thread).For backwards compatibility, this default implementation calls
postDiffHook(Differencer, IDiffContainer)
from the UI thread. Clients should override this method even if they don't perform post processing to avoid the call to the UI thread.- Parameters:
differencer
- the differencer used to perform the differencingroot
- the non-null
root node of the difference treemonitor
- a progress monitor ornull
if progress is not required- Since:
- 3.3
-
propertyChange
Tracks property changes of the configuration object. Clients may override to track their own property changes. In this case they must call the inherited method.- Overrides:
propertyChange
in classDiffTreeViewer
- Parameters:
event
- the property changed event that triggered the call to this method
-
copySelected
protected void copySelected(boolean leftToRight) Overridden to call thesave
method on the structure creator after nodes have been copied from one side to the other side of an input object.- Overrides:
copySelected
in classDiffTreeViewer
- Parameters:
leftToRight
- iftrue
the left side is copied to the right side. Iffalse
the right side is copied to the left side
-
postDiffHook(Differencer, IDiffContainer, IProgressMonitor)
instead