Package org.eclipse.compare.structuremergeviewer
Package Specification
The class Differencer is a differencing engine for hierarchically structured data. It takes two or three inputs and performs a two-way or three-way compare on them.If the input elements to the differencing engine implement the IStructureComparator interface the engine recursively applies itself to the children of the input element. Leaf elements must implement the org.eclipse.compare.IStreamContentAccessor interface so that the differencer can perform a bytewise comparison on their contents.
One good example for this is org.eclipse.compare.ResourceNode which implements both interfaces (and more) for Eclipse workspace resources (org.eclipse.core.resources.IResource).
Another example is the DocumentRangeNode which can be used to compare hierarchical structures
that are superimposed on a document, that is where nodes and leafs correspond to ranges in a document
(org.eclipse.compare.contentmergeviewer.IDocumentRange).
Typically DocumentRangeNodes are created while parsing a document and they represent
the semantic entities of the document (e.g. a Java class, method or field).
The two subclasses JavaNode (in org.eclipse.jdt.internal.ui.compare)
and PropertyNode (in org.eclipse.jdt.internal.ui.compare) are good examples for this.
By default the differencing engine returns the result of the compare operation as a tree of DiffNode objects. However, this can be changed by overriding a single method of the engine.
Every DiffNode describes the changes among the two or three inputs.
A tree of DiffNodes can be displayed in a DiffTreeViewer. The DiffTreeViewer requires that inner nodes of the tree implement the IDiffContainer interface and leafs the IDiffElement interface.
The typical steps to compare hierarchically structured data and to display the differences would be to:
- map the input data into a tree of IStructureComparator and IStreamContentAccessors,
- perform the compare operation by means of the Differencer, and
- feed the differencing result into the DiffTreeViewer.
-
ClassDescriptionThe standard implementation of a diff container element.An abstract base implementation of the
IDiffElement
interface.A generic two-way or three-way differencing engine.Diff node are used as the compare result of the differencing engine.A tree viewer that works on objects implementing theIDiffContainer
andIDiffElement
interfaces.A document range node represents a structural element when performing a structure compare of documents.Interface for objects used as input to a two-way or three-way compare viewer.Listener that gets informed if one (or more) of the three sides of anICompareInput
object changes its value.IDiffContainer
is aIDiffElement
with children.AnIDiffElement
is used in theDiffTreeViewer
to display the kind of change detected as the result of a two-way or three-way compare.Interface used to compare hierarchical structures.Interface used to create a hierarchical structure ofIStructureComparator
s for a given input object.An extension to theIStructureCreator
interface that supports the use of shared documents.An implementation ofISharedDocumentAdapter
that wraps another shared document adapter.AnIStructureCreator2
that attempts to use anIDocumentProvider
to obtain a shared document for anITypedElement
.A diff tree viewer that can be configured with aIStructureCreator
to retrieve a hierarchical structure from the input object (anICompareInput
) and perform a two-way or three-way compare on it.A node that acts as the root of the tree returned from aStructureCreator
.