Free tutorials for Java, Eclipse and Web programming



Eclipse Zest - Tutorial

Lars Vogel

Version 0.8

25.11.2009

Revision History
Revision 0.107.06.2009Lars Vogel
Created Article
Revision 0.216.06.2009Lars Vogel
First example
Revision 0.321.06.2009Lars Vogel
Added PDE Dependency Visualization
Revision 0.404.08.2009Lars Vogel
Minor corrections
Revision 0.524.09.2009Lars Vogel
Added Zest JFace
Revision 0.628.09.2009Lars Vogel
Added IGraphEntityContentProvider
Revision 0.729.09.2009Lars Vogel
Added Filter
Revision 0.825.11.2009Lars Vogel
Fixed typo

Eclipse Zest

Eclipse Zest is a visualization toolkit for graphs. This article explains how to create directly a Zest graph and how to use the JFace abstraction.

In this article Eclipse 3.5 (Eclipse Galileo) is used.


Table of Contents

1. Eclipse Zest
1.1. Overview
1.2. Components
1.3. Layout Manager
1.4. Filter
2. Installation
3. Your first Zest Project
3.1. Create Project
3.2. Add dependencies
3.3. View
3.4. Select layout manager via a command
4. Zest and JFace
5. Zest and JFace Example
5.1. Create Project
5.2. Model
5.3. Providers
5.4. View
5.5. Filter
6. Tips and Tricks
6.1. Disable that nodes can be moved manually
7. PDE Dependency Visualization
8. Thank you
9. Questions and Discussion
10. Links and Literature
10.1. Source Code
10.2. Eclipse Zest Resources
10.3. Other Resources

1. Eclipse Zest

1.1. Overview

Eclipse Zest is a visualization toolkit for graphs. It is based on SWT / Draw2D. Zest supports the viewer concept from JFace and therefore allows to separate the model from the graphical representation of the model.

This article assumes that you are already familiar with Eclipse RCP or Eclipes Plugin development. See Eclipse RCP or Eclipse Plugin Tutorial for an introduction to these topics.

1.2. Components

Eclipse Zest has the following components:

  • GraphNode - Node in the graph with the properties

  • GraphConnections - Arrow / Edge of the graph which connections to two nodes

  • GraphContainer - Use for a graph within a graph

  • Graph - holds the other elements (nodes, connections, container)

1.3. Layout Manager

Eclipse Zest provides graph layout managers. A graph layout manager determines how the nodes (and the arrows) of a graph are arranged on the screen.

The following layout managers are provided:

Table 1. Layout Manager

Layout Manager Description
TreeLayoutAlgorithmGraph is displayed in the form of a vertical tree
HorizontalTreeLayoutAlgorithmSimilar to TreeLayoutAlgorithm but layout is horizontal
RadialLayoutAlgorithmRoot is in the center, the others nodes are placed around this node
GridLayoutAlgorithm 
SpringLayoutAlgorithmLayout the graph so that all connections should have approx. the same length and that the edges overlap minimal
HorizontalShiftMoves overlapping nodes to the right
CompositeLayoutAlgorithmCombines other layout algorithms, for example HorizontalShift can be the second layout algorithm to move nodes which were still overlapping if another algorithm is used

1.4. Filter

You can also define filters (org.eclipse.zest.layouts.Filter) on the layout managers via the method setFilter(filter). This defines which nodes and connections should be displayed. The filter receives an LayoutItem, the actual graph element can be received with the method getGraphData().