Java Reference
In-Depth Information
file content. As you can see, we added a gradient effect to our SVG so that we
can distinguish this figure from the original.
public class IntermediateEventImageEditPart extends Event2EditPart {
public IntermediateEventImageEditPart(View view) {
super (view);
}
protected IFigure createNodeShape() {
URL url = FileLocator.find(Activator.getDefault().getBundle(),
new Path("images" + IPath.SEPARATOR + "ievent.svg"), null );
return new
ScalableImageFigure(RenderedImageFactory.getInstance(url),
true, true, true);
}
}
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="20" height="20" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="blue_white" x1="0%" y1="0%"
x2="100%" y2="0%">
<stop offset="0%"
style="stop-color:rgb(0,0,255);stop-opacity:1"/>
<stop offset="100%" style="stop-color:rgb(255,255,255);
stop-opacity:1"/>
</linearGradient>
</defs>
<circle cx="10" cy="10" r="9" style="fill:white; stroke:black;
stroke-width:1"/>
<circle cx="10" cy="10" r="7" style="fill:url(#blue_white);
stroke:black; stroke-width:1"/>
</svg>
If we launch our runtime instance, you'll see that our new intermediate event
figure is displayed in place of our original figure. This very simple extension
shows the usefulness of the service provider framework of the runtime for
modifying an existing diagram. However, our Practitioner might prefer the orig-
inal figure or would like to switch between the two. We'll add this capability
through a menu action on our figure, allowing us to demonstrate the
contributionItemProviders extension-point.
Search WWH ::




Custom Search