@Override
  protected void postMoveShape(final IMoveShapeContext context) {
    super.postMoveShape(context);
    PictogramElement containerShape = context.getPictogramElement();
    Activity activity = BusinessObjectUtil.getFirstElementOfType(containerShape, Activity.class);
    GraphicsUtil.sendToFront(context.getShape());

    new AbstractBoundaryEventOperation() {
      @Override
      protected void doWorkInternal(ContainerShape container) {
        GraphicsAlgorithm ga = container.getGraphicsAlgorithm();

        MoveShapeContext newContext = new MoveShapeContext(container);
        newContext.setDeltaX(context.getDeltaX());
        newContext.setDeltaY(context.getDeltaY());
        newContext.setSourceContainer(context.getSourceContainer());
        newContext.setTargetContainer(context.getTargetContainer());
        newContext.setTargetConnection(context.getTargetConnection());
        newContext.setLocation(ga.getX(), ga.getY());
        newContext.putProperty(ACTIVITY_MOVE_PROPERTY, true);

        IMoveShapeFeature moveFeature = getFeatureProvider().getMoveShapeFeature(newContext);
        if (moveFeature.canMoveShape(newContext)) {
          moveFeature.moveShape(newContext);
        }
      }
    }.doWork(activity, getDiagram());

    if (containerShape.eContainer() instanceof ContainerShape) {
      PictogramElement pe = (PictogramElement) containerShape.eContainer();
      if (BusinessObjectUtil.containsElementOfType(pe, SubProcess.class)) {
        layoutPictogramElement(pe);
      }
    }
  }
Пример #2
0
 @Override
 public void moveShape(IMoveShapeContext context) {
   // if this Label Shape is part of a multiselection, and if its owner is included
   // in that multiselection, then do not move the label. Moving the label is
   // already handled by the label's owner.
   PictogramElement pes[] =
       getFeatureProvider()
           .getDiagramTypeProvider()
           .getDiagramBehavior()
           .getDiagramContainer()
           .getSelectedPictogramElements();
   Shape shape = context.getShape();
   for (PictogramElement pe : pes) {
     ContainerShape s = BusinessObjectUtil.getFirstElementOfType(pe, ContainerShape.class);
     if (s == shape) return;
   }
   super.moveShape(context);
 }