Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Eclipse Platform
Release 3.5


Provides support for finding and displaying the differences between hierarchically structured data.


Interface Summary
ICompareInput Interface for objects used as input to a two-way or three-way compare viewer.
ICompareInputChangeListener Listener that gets informed if one (or more) of the three sides of an ICompareInput object changes its value.
IDiffContainer IDiffContainer is a IDiffElement with children.
IDiffElement An IDiffElement is used in the DiffTreeViewer to display the kind of change detected as the result of a two-way or three-way compare.
IStructureComparator Interface used to compare hierarchical structures.
IStructureCreator Interface used to create a hierarchical structure of IStructureComparators for a given input object.
IStructureCreator2 An extension to the IStructureCreator interface that supports the use of shared documents.

Class Summary
DiffContainer The standard implementation of a diff container element.
DiffElement An abstract base implementation of the IDiffElement interface.
Differencer A generic two-way or three-way differencing engine.
DiffNode Diff node are used as the compare result of the differencing engine.
DiffTreeViewer A tree viewer that works on objects implementing the IDiffContainer and IDiffElement interfaces.
DocumentRangeNode A document range node represents a structural element when performing a structure compare of documents.
SharedDocumentAdapterWrapper An implementation of ISharedDocumentAdapter that wraps another shared document adapter.
StructureCreator An IStructureCreator2 that attempts to use an IDocumentProvider to obtain a shared document for an ITypedElement.
StructureDiffViewer A diff tree viewer that can be configured with a IStructureCreator to retrieve a hierarchical structure from the input object (an ICompareInput) and perform a two-way or three-way compare on it.
StructureRootNode A node that acts as the root of the tree returned from a StructureCreator.

Package Description

Provides support for finding and displaying the differences between hierarchically structured data.

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 interface so that the differencer can perform a bytewise comparison on their contents.

One good example for this is 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 (
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 and PropertyNode (in 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.
The StructureDiffViewer is a specialized DiffTreeViewer that automates the three steps from above. It takes a single input object of type ICompareInput from which it retrieves the two or three input elements to compare. Then it uses a IStructureCreator to extract a tree of IStructureComparator and IStreamContentAccessor from them. These trees are then compared with the differencing engine and the result is displayed in the tree viewer.

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire