コード例 #1
0
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.eclipse.emf.compare.uml2.diff.internal.extension.IDiffExtensionFactory#create(org.eclipse.emf.compare.diff.metamodel.DiffElement,
   *     org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer)
   */
  public AbstractDiffExtension create(
      DiffElement input, EcoreUtil.CrossReferencer crossReferencer) {
    final ModelElementChangeLeftTarget changeLeftTarget = (ModelElementChangeLeftTarget) input;
    final Message message = (Message) changeLeftTarget.getLeftElement();

    final UMLMessageChangeLeftTarget ret =
        UML2DiffFactory.eINSTANCE.createUMLMessageChangeLeftTarget();

    final MessageEnd receiveEvent = message.getReceiveEvent();
    if (receiveEvent != null) {
      hideEvent(receiveEvent, ret, crossReferencer);
    }

    final MessageEnd sendEvent = message.getSendEvent();
    if (sendEvent != null) {
      hideEvent(sendEvent, ret, crossReferencer);
    }

    ret.getHideElements().add(changeLeftTarget);
    ret.getRequires().add(changeLeftTarget);

    ret.setRemote(changeLeftTarget.isRemote());
    ret.setRightParent(changeLeftTarget.getRightParent());
    ret.setLeftElement(changeLeftTarget.getLeftElement());

    return ret;
  }
コード例 #2
0
 public static boolean canReorientTarget(Message message, Element newTarget) {
   if (message == null || newTarget == null) {
     return false;
   }
   Element source = null;
   MessageEnd sendEvent = message.getSendEvent();
   if (sendEvent instanceof OccurrenceSpecification) {
     EList<Lifeline> covereds = ((OccurrenceSpecification) sendEvent).getCovereds();
     if (!covereds.isEmpty()) {
       source = covereds.get(0);
     }
   } else if (sendEvent instanceof Gate
       // special handling of SyncMessages due to #425666
       && MessageSort.SYNCH_CALL_LITERAL != message.getMessageSort()) {
     source = ((Gate) sendEvent).getOwner();
   }
   return canExist(message, source, newTarget);
 }