@Override
  public void addBendpoint(IAddBendpointContext context) {
    super.addBendpoint(context);
    try {
      FreeFormConnection connection = context.getConnection();
      BaseElement element =
          (BaseElement) BusinessObjectUtil.getFirstElementOfType(connection, BaseElement.class);
      ModelHandler modelHandler = ModelHandlerLocator.getModelHandler(getDiagram().eResource());

      Point p = DcFactory.eINSTANCE.createPoint();
      p.setX(context.getX());
      p.setY(context.getY());

      BPMNEdge edge = (BPMNEdge) modelHandler.findDIElement(getDiagram(), element);
      int index = context.getBendpointIndex() + 1;
      edge.getWaypoint().add(index, p);
      if (index == 1) {
        AnchorUtil.reConnect((BPMNShape) edge.getSourceElement(), getDiagram());
      } else if (index == connection.getBendpoints().size()) {
        AnchorUtil.reConnect((BPMNShape) edge.getTargetElement(), getDiagram());
      }

    } catch (Exception e) {
      Activator.logError(e);
    }
  }
 @Override
 public Object[] create(ICreateContext context) {
   BaseElement element = null;
   try {
     ModelHandler handler = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
     element = add(context.getTargetContainer(), handler);
   } catch (IOException e) {
     Activator.logError(e);
   }
   addGraphicalRepresentation(context, element);
   return new Object[] {element};
 }
  @Override
  public Object[] create(ICreateContext context) {
    Participant p = null;

    try {
      ModelHandler mh = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
      p = mh.addParticipant();
      p.setName("Pool nr " + index++);
    } catch (IOException e) {
      Activator.logError(e);
    }

    addGraphicalRepresentation(context, p);
    return new Object[] {p};
  }