This chapter is from the book
2.4 Draw2D View
The above example diagram can also be displayed in a view that is part of an Eclipse RCP application (see Chapter 7 in the Eclipse Plug-ins book for more about views). Start by adding the following extension to the plugin.xml:
<extension point="org.eclipse.ui.views"> <category id="com.qualityeclipse.gef" name="GEF Book"> </category> <view category="com.qualityeclipse.gef" class="com.qualityeclipse.genealogy.view.GenealogyView" id="com.qualityeclipse.genealogy.view" name="Genealogy" restorable="true"> </view> </extension>
Now modify the GenealogyView class to be a subclass of org.eclipse.ui.part.ViewPart, and add the following methods:
package com.qualityeclipse.genealogy.view; ... existing imports ... import org.eclipse.ui.part.ViewPart; public class GenealogyView extends ViewPart { public void createPartControl(Composite parent) { createDiagram(parent); } public void setFocus() { } ... existing methods ... }
When you launch the runtime workbench and open the Genealogy view, you'll see something like this (see Figure 2–6).

Figure 2–6 The Genealogy view.