コード例 #1
0
  /** {@inheritDoc} */
  @Override
  protected Command createDeleteViewCommand(GroupRequest deleteRequest) {
    CompoundCommand deleteViewsCommand = new CompoundCommand();

    /* apex added start */
    // Activation의 source connections들을 parent인 lifeline으로 이동하여 연결
    if (getHost() instanceof ShapeNodeEditPart) {
      LifelineEditPart lifelineEP = SequenceUtil.getParentLifelinePart(getHost());
      IFigure figure = lifelineEP.getNodeFigure();
      Rectangle newBounds = figure.getBounds().getCopy();
      figure.translateToAbsolute(newBounds);

      List connections = ((ShapeNodeEditPart) getHost()).getSourceConnections();
      for (Iterator iter = connections.iterator(); iter.hasNext(); ) {
        ConnectionNodeEditPart connection = (ConnectionNodeEditPart) iter.next();
        Point location = SequenceUtil.getAbsoluteEdgeExtremity(connection, true);

        ReconnectRequest reconnReq = new ReconnectRequest();
        reconnReq.setConnectionEditPart(connection);
        reconnReq.setLocation(location);
        reconnReq.setTargetEditPart(lifelineEP);
        reconnReq.setType(RequestConstants.REQ_RECONNECT_SOURCE);
        reconnReq.getExtendedData().put(SequenceRequestConstant.DO_NOT_MOVE_EDIT_PARTS, true);

        deleteViewsCommand.add(lifelineEP.getCommand(reconnReq));
      }
    }
    /* apex added end */

    Command deleteViewCommand = super.createDeleteViewCommand(deleteRequest);
    deleteViewsCommand.add(deleteViewCommand);
    if (getHost() instanceof ShapeNodeEditPart) {
      TransactionalEditingDomain editingDomain = ((ShapeNodeEditPart) getHost()).getEditingDomain();
      SequenceDeleteHelper.completeDeleteExecutionSpecificationViewCommand(
          deleteViewsCommand, editingDomain, getHost());
    }

    return deleteViewsCommand;
  }
 public static Rectangle fixMessageBounds(
     Rectangle newBounds, Request cvr, LifelineEditPart host) {
   Object oc1 =
       getFirstElement(
           cvr.getExtendedData().get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION));
   Object oc2 =
       getFirstElement(
           cvr.getExtendedData().get(SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION_2));
   if (oc1 != null
       && oc2 != null
       && (oc1 instanceof MessageOccurrenceSpecification
           || oc2 instanceof MessageOccurrenceSpecification)) {
     Point start = null, end = null;
     Rectangle bounds = null;
     if (oc1 instanceof InteractionFragment) {
       start = SequenceUtil.findLocationOfEvent(host, (InteractionFragment) oc1, true);
     }
     if (oc2 instanceof InteractionFragment) {
       end = SequenceUtil.findLocationOfEvent(host, (InteractionFragment) oc2, true);
     }
     if (start != null && end != null) {
       bounds = (start.y < end.y) ? new Rectangle(start, end) : new Rectangle(end, start);
     }
     if (bounds != null) {
       IFigure parentFigure = host.getFigure();
       Point parentFigDelta = parentFigure.getBounds().getLocation().getCopy().negate();
       parentFigure.translateToRelative(bounds);
       bounds.translate(parentFigDelta);
       if (bounds.y != newBounds.y || newBounds.height != bounds.height) {
         newBounds.y = bounds.y;
         newBounds.height = bounds.height;
       }
     }
   }
   return newBounds;
 }
コード例 #3
0
  protected void showChangeBoundsFeedback(ChangeBoundsRequest request) {
    IFigure feedback = getDragSourceFeedbackFigure();

    PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
    getHostFigure().translateToAbsolute(rect);

    // Only enable horizontal dragging on lifelines(except lifelines that are result of a create
    // message).
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=364688
    if (this.getHost() instanceof LifelineEditPart) {
      LifelineEditPart lifelineEP = (LifelineEditPart) this.getHost();
      if (!SequenceUtil.isCreateMessageEndLifeline(lifelineEP)) {
        request.getMoveDelta().y = 0;
      }
    }

    rect.translate(request.getMoveDelta());
    rect.resize(request.getSizeDelta());

    IFigure f = getHostFigure();
    Dimension min = f.getMinimumSize().getCopy();
    Dimension max = f.getMaximumSize().getCopy();
    IMapMode mmode = MapModeUtil.getMapMode(f);
    min.height = mmode.LPtoDP(min.height);
    min.width = mmode.LPtoDP(min.width);
    max.height = mmode.LPtoDP(max.height);
    max.width = mmode.LPtoDP(max.width);

    if (min.width > rect.width) rect.width = min.width;
    else if (max.width < rect.width) rect.width = max.width;

    if (min.height > rect.height) rect.height = min.height;
    else if (max.height < rect.height) rect.height = max.height;

    feedback.translateToRelative(rect);
    feedback.setBounds(rect);
  }