return bo != null && bo instanceof Activity;
}
@Override
public PictogramElement add(IAddContext context) {
BoundaryEvent event = (BoundaryEvent) context.getNewObject();
Object prop = context.getProperty(DIImport.IMPORT_PROPERTY);
boolean importing = prop != null && (Boolean) prop;
ContainerShape target = importing ? context.getTargetContainer() : (ContainerShape) context
.getTargetContainer().eContainer();
ContainerShape containerShape = peService.createContainerShape(target, true);
Ellipse ellipse = gaService.createEllipse(containerShape);
StyleUtil.applyBGStyle(ellipse, this);
if (importing) { // if loading from DI then place according to context
gaService.setLocationAndSize(ellipse, context.getX(), context.getY(), EVENT_SIZE, EVENT_SIZE);
} else { // otherwise place it in the center of shape for user to adjust it
GraphicsAlgorithm ga = context.getTargetContainer().getGraphicsAlgorithm();
int x = ga.getX() + context.getX() - (EVENT_SIZE / 2);
int y = ga.getY() + context.getY() - (EVENT_SIZE / 2);
gaService.setLocationAndSize(ellipse, x, y, EVENT_SIZE, EVENT_SIZE);
}
Ellipse circle = GraphicsUtil.createIntermediateEventCircle(ellipse);
circle.setStyle(StyleUtil.getStyleForClass(getDiagram()));
createDIShape(containerShape, event);
ChopboxAnchor anchor = peService.createChopboxAnchor(containerShape);
anchor.setReferencedGraphicsAlgorithm(ellipse);
AnchorUtil.addFixedPointAnchors(containerShape, ellipse);
Activity activity = event.getAttachedToRef();
PictogramElement foundElem = BusinessObjectUtil.getFirstBaseElementFromDiagram(getDiagram(), activity);
if (foundElem != null && foundElem instanceof ContainerShape) {
ContainerShape activityContainer = (ContainerShape) foundElem;
PositionOnLine pos = BoundaryEventPositionHelper.getPositionOnLineUsingBPMNShape(containerShape,
activityContainer);