return isAnnotation && (intoDiagram || intoLane || intoSubProcess);
}
@Override
public PictogramElement add(IAddContext context) {
final TextAnnotation annotation = (TextAnnotation) context.getNewObject();
final IPeCreateService peCreateService = Graphiti.getPeCreateService();
final ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);
final IGaService gaService = Graphiti.getGaService();
// TODO: we currently only support horizontal lanes!!!
final int height = Math.max(50, context.getHeight());
final int width = Math.max(100, context.getWidth());
final int commentEdge = 20;
final Rectangle rect = gaService.createInvisibleRectangle(containerShape);
gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
final Shape lineShape = peCreateService.createShape(containerShape, false);
final Polyline line
= gaService.createPolyline(lineShape
, new int[] { commentEdge, 0, 0, 0, 0, height, commentEdge, height });
line.setStyle(StyleUtil.getStyleForTask(getDiagram()));
line.setLineWidth(2);
gaService.setLocationAndSize(line, 0, 0, commentEdge, height);
final Shape textShape = peCreateService.createShape(containerShape, false);
final MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, annotation.getText());
text.setStyle(StyleUtil.getStyleForTask(getDiagram()));
text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
text.setFont(gaService.manageFont(getDiagram(), text.getFont().getName(), 11));
}