In the graphics framework's architecture a UI platform dependent and a diagram type independent interaction component communicates with a platform independent diagram type agent (see Figure). A diagram type agent consists mainly of a diagram type provider, a feature provider and its provided features.
Figure: Interaction Component talks to Diagram Type Agent
In this chapter we want to implement a feature provider and wire it with the diagram type provider.
A feature provider has to implement interface IFeatureProvider. Instead of implementing it directly you should extend one of the available base classes. In this example we extend class DefaultFeatureProvider and do not have to implement or overwrite any methods initially.
You can see the complete implementation of the feature provider here:
package org.eclipse.graphiti.examples.tutorial.diagram;
public class TutorialFeatureProvider
extends DefaultFeatureProvider {
public TutorialFeatureProvider(IDiagramTypeProvider
dtp) {
super(dtp);
}
}
To create and set our feature provider in the diagram type provider we just have to add one line in the diagram type provider’s constructor:
public MyTutorialDiagramTypeProvider()
{
super();
setFeatureProvider(new TutorialFeatureProvider(this));
}
Since the basic steps are done you can run the first version of this tutorial editor. It should be possible to create and open a diagram.
For this follow the steps described in the example project to open the empty diagram editor.