The tool behavior provider is needed to integrate into the standard workbench tools. In most cases this means adding functionality to existing editing concepts of the workbench.
Typical examples are:
To create a tool behavior provider the interface IToolBehaviorProvider has to be implemented. Instead of implementing this directly you should extend the base classe DefaultToolBehaviorProvider.
At this point we will just create an empty tool behavior provider by extending the base class.
You can see the implementation of the empty tool behavior provider here. We will add further functionality in the next chapters.
This implementation can be seen here:
package org.eclipse.graphiti.examples.tutorial.diagram;
import org.eclipse.graphiti.dt.AbstractDiagramTypeProvider;
import org.eclipse.graphiti.tb.IToolBehaviorProvider;
public class MyTutorialDiagramTypeProvider
extends AbstractDiagramTypeProvider {
private IToolBehaviorProvider[]
toolBehaviorProviders;
public MyTutorialDiagramTypeProvider()
{
super();
setFeatureProvider(new TutorialFeatureProvider(this));
}
@Override
public IToolBehaviorProvider[] getAvailableToolBehaviorProviders()
{
if
(toolBehaviorProviders ==
null) {
toolBehaviorProviders =
new IToolBehaviorProvider[] {
new MyTutorialToolBehaviorProvider(
this) };
}
return
toolBehaviorProviders;
}
}