@Override
  protected void preMoveShape(IMoveShapeContext context) {
    MoveShapeContext msc = (MoveShapeContext) context;
    ContainerShape oldContainer = context.getSourceContainer();
    ContainerShape newContainer = context.getTargetContainer();
    IPeLayoutService peLayoutService = Graphiti.getPeLayoutService();
    //		Shape shape = context.getShape();
    //		ILocation loc = peService.getLocationRelativeToDiagram(shape);
    ILocation oldLoc = peLayoutService.getLocationRelativeToDiagram(oldContainer);
    ILocation newLoc = peLayoutService.getLocationRelativeToDiagram(newContainer);
    //		System.out.println(
    //				(oldContainer==newContainer ? "inside:\n" : "outside:\n")+
    //				"oldContainer:\n" +
    //				"  x="+oldLoc.getX()+"\n"+
    //					"  y="+oldLoc.getY()+"\n"+
    //				"newContainer:\n" +
    //				"  x="+newLoc.getX()+"\n"+
    //					"  y="+newLoc.getY()+"\n"+
    //				"shape:\n" +
    //				"  rel x="+shape.getGraphicsAlgorithm().getX()+"\n"+
    //					"  rel y="+shape.getGraphicsAlgorithm().getY()+"\n"+
    //				"  abs x="+loc.getX()+"\n"+
    //					"  abs y="+loc.getY()+"\n"+
    //				"context:\n" +
    //				"  x="+msc.getX()+"\n"+
    //					"  y="+msc.getY()+"\n"+
    //				"  deltaX="+msc.getDeltaX()+"\n"+
    //					"  deltaY="+msc.getDeltaY()+"\n"+
    //				"\n"
    //		);

    if (oldContainer != newContainer) {
      int x = newLoc.getX() + msc.getX() - oldLoc.getX();
      int y = newLoc.getY() + msc.getY() - oldLoc.getY();
      int deltaX = newLoc.getX() + msc.getDeltaX() - oldLoc.getX();
      int deltaY = newLoc.getY() + msc.getDeltaY() - oldLoc.getY();

      //			System.out.println(
      //					"new context:\n"+
      //					"  x="+( newLoc.getX() + msc.getX() - oldLoc.getX() )+"\n"+
      //								"  y="+msc.getY()+"\n"+
      //					"  deltaX="+( newLoc.getX() + msc.getDeltaX() - oldLoc.getX() )+"\n"+
      //								"  deltaY="+msc.getDeltaY()+"\n"+
      //					"\n"
      //			);

      //			msc.setX(x);
      //			msc.setY(y);
      //			msc.setDeltaX(deltaX);
      //			msc.setDeltaY(deltaY);
      //			msc.setTargetContainer(oldContainer);
    }

    super.preMoveShape(context);
  }
  private void modifyModelStructure(IMoveShapeContext context) {
    Lane movedLane = getMovedLane(context);
    Process sourceProcess = getProcess(context.getSourceContainer());
    Process targetProcess = getProcess(context.getTargetContainer());
    moveLane(movedLane, sourceProcess, targetProcess);

    for (LaneSet laneSet : sourceProcess.getLaneSets()) {
      if (laneSet.getLanes().contains(movedLane)) {
        laneSet.getLanes().remove(movedLane);
        if (laneSet.getLanes().isEmpty()) {
          sourceProcess.getLaneSets().remove(laneSet);
        }

        if (targetProcess.getLaneSets().isEmpty()) {
          LaneSet newLaneSet = createLaneSet();
          targetProcess.getLaneSets().add(newLaneSet);
        }
        targetProcess.getLaneSets().get(0).getLanes().add(movedLane);
        break;
      }
    }
  }
  private void modifyModelStructure(IMoveShapeContext context) {
    Lane movedLane = getMovedLane(context);
    Participant sourceParticipant =
        (Participant) getBusinessObjectForPictogramElement(context.getSourceContainer());
    Participant internalParticipant = null;

    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      internalParticipant = handler.getInternalParticipant();
      handler.moveLane(movedLane, internalParticipant);
    } catch (IOException e) {
      Activator.logError(e);
    }

    LaneSet laneSet = null;
    for (LaneSet set : sourceParticipant.getProcessRef().getLaneSets()) {
      if (set.getLanes().contains(movedLane)) {
        laneSet = set;
        break;
      }
    }

    if (laneSet != null) {
      laneSet.getLanes().remove(movedLane);
      if (laneSet.getLanes().isEmpty()) {
        sourceParticipant.getProcessRef().getLaneSets().remove(laneSet);
      }

      Process process = internalParticipant.getProcessRef();
      if (process.getLaneSets().isEmpty()) {
        LaneSet createLaneSet = ModelHandler.FACTORY.createLaneSet();
        //				createLaneSet.setId(EcoreUtil.generateUUID());
        process.getLaneSets().add(createLaneSet);
        ModelUtil.setID(createLaneSet);
      }
      process.getLaneSets().get(0).getLanes().add(movedLane);
    }
  }
 @Override
 protected void internalMove(IMoveShapeContext context) {
   modifyModelStructure(context);
   layoutPictogramElement(context.getSourceContainer());
 }
 @Override
 protected void internalMove(IMoveShapeContext context) {
   modifyModelStructure(context);
   FeatureSupport.redraw(context.getSourceContainer());
 }