public void moveLane(
     Lane movedLane, Participant sourceParticipant, Participant targetParticipant) {
   Process sourceProcess = getOrCreateProcess(sourceParticipant);
   Process targetProcess = getOrCreateProcess(targetParticipant);
   for (FlowNode node : movedLane.getFlowNodeRefs()) {
     moveFlowNode(node, sourceProcess, targetProcess);
   }
   if (movedLane.getChildLaneSet() != null && !movedLane.getChildLaneSet().getLanes().isEmpty()) {
     for (Lane lane : movedLane.getChildLaneSet().getLanes()) {
       moveLane(lane, sourceParticipant, targetParticipant);
     }
   }
 }
  private int findMissingDIElements(
      DiagramElementTreeNode missing, LaneSet laneSet, List<FlowElement> laneElements) {
    int added = 0;
    if (laneSet != null) {
      for (Lane lane : laneSet.getLanes()) {
        // create the missing tree node for this Lane's container
        // this is either a FlowElementsContainer or another Lane
        BaseElement container = (BaseElement) lane.eContainer().eContainer();
        DiagramElementTreeNode containerNode = missing.getChild(container);
        if (containerNode == null) containerNode = missing.addChild(container);
        DiagramElementTreeNode parentNode = containerNode.addChild(lane);

        for (FlowNode fn : lane.getFlowNodeRefs()) {
          if (isMissingDIElement(fn)) {
            parentNode.addChild(fn);
            laneElements.add(fn);
            ++added;
          }
        }
        added += findMissingDIElements(parentNode, lane.getChildLaneSet(), laneElements);

        if (added == 0) {
          containerNode.removeChild(lane);
          missing.removeChild(container);
        }
      }
    }
    return added;
  }
  public Lane createLane(Lane targetLane) {
    Lane lane = FACTORY.createLane();
    //		lane.setId(EcoreUtil.generateUUID());
    ModelUtil.setID(lane, resource);

    if (targetLane.getChildLaneSet() == null) {
      targetLane.setChildLaneSet(ModelHandler.FACTORY.createLaneSet());
    }

    LaneSet targetLaneSet = targetLane.getChildLaneSet();
    targetLaneSet.getLanes().add(lane);

    lane.getFlowNodeRefs().addAll(targetLane.getFlowNodeRefs());
    targetLane.getFlowNodeRefs().clear();

    return lane;
  }
  public static boolean isInLane(FlowElement fe, LaneSet ls) {
    if (ls == null || ls.getLanes().size() == 0) return false;

    for (Lane ln : ls.getLanes()) {
      if (ln.getFlowNodeRefs().contains(fe)) return true;
      if (isInLane(fe, ln.getChildLaneSet())) return true;
    }
    return false;
  }
 public static boolean isTargetLaneOnTop(ITargetContext context) {
   Lane lane = BusinessObjectUtil.getFirstElementOfType(context.getTargetContainer(), Lane.class);
   return lane.getChildLaneSet() == null || lane.getChildLaneSet().getLanes().isEmpty();
 }
 public static boolean isLaneOnTop(Lane lane) {
   return lane.getChildLaneSet() == null || lane.getChildLaneSet().getLanes().isEmpty();
 }