}
// 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, addedTask.getName());
text.setStyle(StyleUtil.getStyleForTask(getDiagram()));
text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
text.setFont(gaService.manageFont(getDiagram(), text.getFont().getName(), 11));
}
switch (baseShape) {
case ACTIVITY:
gaService.setLocationAndSize(text, 0, 20, width, height - 25);
break;
case GATEWAY:
gaService.setLocationAndSize(text, 0, height + 5, width, 40);
break;
case EVENT:
gaService.setLocationAndSize(text, 0, height + 5, width, 40);
break;
}
// create link and wire it
link(shape, addedTask);
// provide information to support direct-editing directly
// after object creation (must be activated additionally)
final IDirectEditingInfo directEditingInfo = getFeatureProvider().getDirectEditingInfo();
// set container shape for direct editing after object creation
directEditingInfo.setMainPictogramElement(containerShape);
// set shape and graphics algorithm where the editor for
// direct editing shall be opened after object creation
directEditingInfo.setPictogramElement(shape);
directEditingInfo.setGraphicsAlgorithm(text);
}
{
final Shape shape = peCreateService.createShape(containerShape, false);
final Image image = gaService.createImage(shape, getIcon(addedTask));
switch (baseShape) {
case ACTIVITY:
gaService.setLocationAndSize(image, 5, 5, IMAGE_SIZE, IMAGE_SIZE);