return isAnnotation && (intoDiagram || intoLane || intoSubProcess);
}
@Override
public PictogramElement add(IAddContext context) {
TextAnnotation annotation = (TextAnnotation) context.getNewObject();
IPeCreateService peCreateService = Graphiti.getPeCreateService();
ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);
IGaService gaService = Graphiti.getGaService();
int width = context.getWidth() > 0 ? context.getWidth() : 50;
int height = context.getHeight() > 0 ? context.getHeight() : 100;
int commentEdge = 15;
Rectangle rect = gaService.createInvisibleRectangle(containerShape);
gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
Shape lineShape = peCreateService.createShape(containerShape, false);
Polyline line = gaService.createPolyline(lineShape, new int[] { commentEdge, 0, 0, 0, 0, height, commentEdge,
height });
line.setStyle(StyleUtil.getStyleForClass(getDiagram()));
line.setLineWidth(2);
gaService.setLocationAndSize(line, 0, 0, commentEdge, height);
Shape textShape = peCreateService.createShape(containerShape, false);
MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, annotation.getText());
text.setStyle(StyleUtil.getStyleForText(getDiagram()));
text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
gaService.setLocationAndSize(text, 5, 5, width - 5, height - 5);
createDIShape(containerShape, annotation);