final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
final int height = context.getHeight() <= 0 ? 35 : context.getHeight();
final IGaService gaService = Graphiti.getGaService();
Ellipse circle;
{
final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
invisibleCircle.setFilled(false);
invisibleCircle.setLineVisible(false);
gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);
// create and set visible circle inside invisible circle
circle = gaService.createEllipse(invisibleCircle);
circle.setParentGraphicsAlgorithm(invisibleCircle);
circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
gaService.setLocationAndSize(circle, 0, 0, width, height);
// create link and wire it
link(containerShape, addedEvent);
}
{
final Shape shape = peCreateService.createShape(containerShape, false);
final Image image = gaService.createImage(shape, PluginImage.IMG_BOUNDARY_SIGNAL.getImageKey());
image.setWidth(20);
image.setHeight(20);
gaService.setLocationAndSize(image, (width - 20) / 2, (height - 20) / 2, 20, 20);
}
// add a chopbox anchor to the shape
peCreateService.createChopboxAnchor(containerShape);
if (!(addedEvent instanceof EndEvent)) {
// create an additional box relative anchor at middle-right
final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
boxAnchor.setRelativeWidth(1.0);
boxAnchor.setRelativeHeight(0.51);
boxAnchor.setReferencedGraphicsAlgorithm(circle);
final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
}
layoutPictogramElement(containerShape);
return containerShape;