}
@Override
public PictogramElement add(IAddContext context) {
final CallActivity addedCallActivity = (CallActivity) context.getNewObject();
final ContainerShape parent = context.getTargetContainer();
// CONTAINER SHAPE WITH ROUNDED RECTANGLE
final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);
// EList<Property> props = containerShape.getProperties();
// check whether the context has a size (e.g. from a create feature)
// otherwise define a default size for the shape
final int width = context.getWidth() <= 0 ? 105 : context.getWidth();
final int height = context.getHeight() <= 0 ? 55 : context.getHeight();
final IGaService gaService = Graphiti.getGaService();
RoundedRectangle roundedRectangle; // need to access it later
{
// create invisible outer rectangle expanded by
// the width needed for the anchor
final Rectangle invisibleRectangle = gaService.createInvisibleRectangle(containerShape);
gaService.setLocationAndSize(invisibleRectangle, context.getX(), context.getY(), width, height);
// create and set visible rectangle inside invisible rectangle
roundedRectangle = gaService.createRoundedRectangle(invisibleRectangle, 5, 5);
roundedRectangle.setParentGraphicsAlgorithm(invisibleRectangle);
roundedRectangle.setStyle(StyleUtil.getStyleForTask(getDiagram()));
roundedRectangle.setLineWidth(3);
gaService.setLocationAndSize(roundedRectangle, 0, 0, width, height);
// create link and wire it
link(containerShape, addedCallActivity);
}
// SHAPE WITH TEXT
{
// create shape for text
final Shape shape = peCreateService.createShape(containerShape, false);
// create and set text graphics algorithm
final MultiText text = gaService.createDefaultMultiText(getDiagram(), shape, addedCallActivity.getName());
text.setStyle(StyleUtil.getStyleForTask(getDiagram()));
text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
Font font = null;
if (OSUtil.getOperatingSystem() == OSEnum.Mac) {