public class StructureDiffViewer extends DiffTreeViewer
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.
IStructureCreator
,
ICompareInput
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
ALL_LEVELS
WIDGET_DATA_KEY
Constructor and Description |
---|
StructureDiffViewer(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.
|
Modifier and Type | Method and Description |
---|---|
protected void |
compareInputChanged(ICompareInput input)
Recreates the comparable structures for the input sides.
|
protected void |
contentChanged(IContentChangeNotifier changed)
Calls
diff whenever the byte contents changes. |
protected void |
copySelected(boolean leftToRight)
Overridden to call the
save 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.
|
IStructureCreator |
getStructureCreator()
Returns the structure creator or
null if no
structure creator has been set with setStructureCreator . |
String |
getTitle()
Reimplemented to get the descriptive title for this viewer from the
IStructureCreator . |
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 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.
Subclasses should override
postDiffHook(Differencer, IDiffContainer, IProgressMonitor)
instead |
protected void |
postDiffHook(Differencer differencer,
IDiffContainer root,
IProgressMonitor monitor)
This method is called from within
diff(IProgressMonitor) after
the difference tree has been built. |
protected void |
preDiffHook(IStructureComparator ancestor,
IStructureComparator left,
IStructureComparator right)
Deprecated.
Clients should override
preDiffHook(IStructureComparator, IStructureComparator, IStructureComparator, IProgressMonitor) |
protected void |
preDiffHook(IStructureComparator ancestor,
IStructureComparator left,
IStructureComparator right,
IProgressMonitor monitor)
This method is called from within
diff(IProgressMonitor) before
the difference tree is being built. |
protected void |
propertyChange(PropertyChangeEvent event)
Tracks property changes of the configuration object.
|
void |
setStructureCreator(IStructureCreator structureCreator)
Configures the
StructureDiffViewer with a structure creator. |
copyOne, createToolItems, dontExpand, expandSelection, fillContextMenu, getBundle, getCompareConfiguration, internalExpandToLevel, navigate
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, expandAll, expandToLevel, expandToLevel, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, 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, 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, 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 StructureDiffViewer(Tree tree, CompareConfiguration configuration)
tree
- the tree controlconfiguration
- the configuration for this viewerpublic StructureDiffViewer(Composite parent, CompareConfiguration configuration)
parent
- the SWT control under which to create the viewerconfiguration
- the configuration for this viewerpublic void setStructureCreator(IStructureCreator structureCreator)
StructureDiffViewer
with a structure creator.
The structure creator is used to create a hierarchical structure
for each side of the viewer's input element of type ICompareInput
.structureCreator
- the new structure creatorpublic IStructureCreator getStructureCreator()
null
if no
structure creator has been set with setStructureCreator
.null
public String getTitle()
IStructureCreator
.getTitle
in class DiffTreeViewer
protected Object getRoot()
diff
.getRoot
in class StructuredViewer
diff
protected void inputChanged(Object input, 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 DiffTreeViewer
input
- the new input of this viewer, or null
if noneoldInput
- the old input element or null
if there
was previously no inputprotected void initialSelection()
DiffTreeViewer
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.initialSelection
in class DiffTreeViewer
protected void handleDispose(DisposeEvent event)
DiffTreeViewer
handleDispose
in class DiffTreeViewer
event
- dispose event that triggered call to this methodprotected void compareInputChanged(ICompareInput input)
input
- this viewer's new inputprotected void contentChanged(IContentChangeNotifier changed)
diff
whenever the byte contents changes.changed
- the object that sent out the notification@Deprecated protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right)
preDiffHook(IStructureComparator, IStructureComparator, IStructureComparator, IProgressMonitor)
diff()
before the
difference tree is being built. Clients may override this method to
perform their own pre-processing. This default implementation does
nothing.ancestor
- the ancestor input to the differencing operationleft
- the left input to the differencing operationright
- the right input to the differencing operationprotected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right, IProgressMonitor monitor)
diff(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.
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 requiredprotected void diff(IProgressMonitor monitor)
monitor
- a progress monitor or null
if progress in not requiredprotected void diff()
@Deprecated protected void postDiffHook(Differencer differencer, IDiffContainer root)
postDiffHook(Differencer, IDiffContainer, IProgressMonitor)
insteaddiff()
after the
difference tree has been built. Clients may override this method to
perform their own post-processing. This default implementation does
nothing.differencer
- the differencer used to perform the differencingroot
- the non-null
root node of the difference treeprotected void postDiffHook(Differencer differencer, IDiffContainer root, IProgressMonitor monitor)
diff(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.
differencer
- the differencer used to perform the differencingroot
- the non-null
root node of the difference treemonitor
- a progress monitor or null
if progress is
not requiredprotected void propertyChange(PropertyChangeEvent event)
propertyChange
in class DiffTreeViewer
event
- the property changed event that triggered the call to this methodprotected void copySelected(boolean leftToRight)
save
method on the structure creator after
nodes have been copied from one side to the other side of an input object.copySelected
in class DiffTreeViewer
leftToRight
- if true
the left side is copied to the right side.
If false
the right side is copied to the left side
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.