@Override
  public PictogramElement createShape(
      Object businessObject,
      ContainerShape layoutParent,
      int width,
      int height,
      IAddContext context) {
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(layoutParent, true);
    final IGaService gaService = Graphiti.getGaService();

    Diagram diagram = getFeatureProvider().getDiagramTypeProvider().getDiagram();
    final Pool addedPool = (Pool) context.getNewObject();

    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
    width = width <= 0 ? 500 : width;
    height = height <= 0 ? 150 : height;

    // 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
    Rectangle rectangle = gaService.createRectangle(invisibleRectangle);
    rectangle.setParentGraphicsAlgorithm(invisibleRectangle);
    rectangle.setStyle(StyleUtil.getStyleForPool(diagram));
    gaService.setLocationAndSize(rectangle, 0, 0, width, height);

    // create shape for text
    final Shape shape = peCreateService.createShape(containerShape, false);

    // create and set text graphics algorithm
    String name = BpmnExtensionUtil.getPoolName(addedPool, ActivitiPlugin.getDefault());
    final Text text = gaService.createDefaultText(diagram, shape, name);
    text.setStyle(StyleUtil.getStyleForEvent(diagram));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_MIDDLE);
    gaService.setLocationAndSize(text, 0, 0, 20, height);
    text.setAngle(-90);
    Font font = null;
    if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
      font = gaService.manageFont(diagram, text.getFont().getName(), 11, false, true);
    } else {
      font = gaService.manageDefaultFont(diagram, false, true);
    }
    text.setFont(font);

    // create link and wire it
    getFeatureProvider().link(shape, addedPool);

    return containerShape;
  }
  @Override
  public PictogramElement add(IAddContext context) {
    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();

    BaseElement element = (BaseElement) context.getNewObject();
    IAddConnectionContext addConContext = (IAddConnectionContext) context;

    Connection connection = peService.createFreeFormConnection(getDiagram());

    Object importProp = context.getProperty(DIImport.IMPORT_PROPERTY);
    if (importProp != null && (Boolean) importProp) {
      connection.setStart(addConContext.getSourceAnchor());
      connection.setEnd(addConContext.getTargetAnchor());
    } else {
      ContainerShape sourceContainer =
          (ContainerShape) addConContext.getSourceAnchor().eContainer();
      ContainerShape targetContainer =
          (ContainerShape) addConContext.getTargetAnchor().eContainer();
      Tuple<FixPointAnchor, FixPointAnchor> anchors =
          AnchorUtil.getSourceAndTargetBoundaryAnchors(
              sourceContainer, targetContainer, connection);

      connection.setStart(anchors.getFirst());
      connection.setEnd(anchors.getSecond());
    }

    if (ModelUtil.hasName(element)) {
      ConnectionDecorator labelDecorator =
          Graphiti.getPeService().createConnectionDecorator(connection, true, 0.5, true);
      Text text = gaService.createText(labelDecorator, ModelUtil.getName(element));
      peService.setPropertyValue(
          labelDecorator, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
      text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    }

    Polyline connectionLine = gaService.createPolyline(connection);
    connectionLine.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

    decorateConnectionLine(connectionLine);

    createDIEdge(connection, element);
    createConnectionDecorators(connection);
    hook(addConContext, connection, element);

    return connection;
  }
  @Override
  protected void hook(
      Activity activity, ContainerShape container, IAddContext context, int width, int height) {
    super.hook(activity, container, context, width, height);
    Graphiti.getPeService().setPropertyValue(container, TRIGGERED_BY_EVENT, "false");

    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();

    Shape textShape = peService.createShape(container, false);
    Text text = gaService.createDefaultText(textShape, activity.getName());
    gaService.setLocationAndSize(text, 5, 5, width - 10, 15);
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
    text.getFont().setBold(true);
    link(textShape, activity);
  }
  @Override
  public PictogramElement add(IAddContext context) {
    // TODO Auto-generated method stub
    IAddConnectionContext addConContext = (IAddConnectionContext) context;
    AdviceEdge edge = (AdviceEdge) context.getNewObject();
    IPeCreateService peCreateService = Graphiti.getPeCreateService();

    Connection connection = peCreateService.createFreeFormConnection(getDiagram());
    connection.setStart(addConContext.getSourceAnchor());
    connection.setEnd(addConContext.getTargetAnchor());

    IGaService gaService = Graphiti.getGaService();
    Polyline polyline = gaService.createPlainPolyline(connection);
    polyline.setStyle(StyleUtil.getStyleForElement(getDiagram()));
    polyline.setLineStyle(LineStyle.DOT);

    link(connection, edge);

    // add dynamic text decorator for the reference name
    ConnectionDecorator textDecorator =
        peCreateService.createConnectionDecorator(connection, true, 0.5, true);
    Text text = gaService.createPlainText(textDecorator);
    text.setStyle(StyleUtil.getStyleForTextDecorator((getDiagram())));
    gaService.setLocation(text, 10, 0);

    text.setValue(edge.getAdvicetype().toString());

    ConnectionDecorator cd;
    cd = peCreateService.createConnectionDecorator(connection, false, 1.0, true);
    int[] xy = {getPointCutR() * 2, 0, 0, -getPointCutR() * 2, 0, 0, 0, getPointCutR() * 2};
    Polygon polygon = Graphiti.getGaCreateService().createPolygon(cd, xy);
    polygon.setStyle(StyleUtil.getStyleForElement(getDiagram()));
    polygon.setLineStyle(LineStyle.DOT);

    return connection;
  }