A team project set file for the digraph2 example is here. Download the team project set file and do the following to import the plug-in project into your workspace.
The objective of the digraph2 example is to add connections to the digraph1 example.
We add edges (Digraph2Edge) to our domain model.
Each edge figure is a PolylineConnection. We also add Digraph2ConnectionAnchor to anchor the edges to the nodes. The edges are anchored to the bottom center and top center of the nodes.
We add an EditPart for edges (Digraph2EdgeEditPart). We also need to make Digraph2NodeEditPart implement NodeEditPart to add source and target connections to the nodes in our directed graph. We finally added a ManhattanConnectionRouter to the ConnectionLayer in the refreshVisuals() method in our Digraph2GraphEditPart.
We add Digraph2EdgeEditPart to Digraph2EditPartFactory.
We make use of a ConnectionEditPolicy to place the edges on the graph (Digraph2ConnectionEditPolicy).
We did not need to make any additional changes to our Digraph2GraphicalEditor.
The graph example editor opens for any file with the digraph2 file extension. So we need a project and file in the workspace to open the editor. First, create a new project resource File > New > Project. Then a new file resource, such as file.digraph2 using File > New > File. After creating the file, the Directed Graph Example Editor will open.
By Anthony Hunter, IBM Rational Software
: /cvsroot/org.eclipse/www/gef/reference/digraph2.php,v 1.3 2007/11/16 04:37:12 ahunter Exp $
Please send comments about this example document to the eclipse.tools.gef newsgroup.
Back to the top