Exemplo n.º 1
0
  public RefOntoUML.GeneralizationSet DealGeneralizationSet(
      org.eclipse.uml2.uml.GeneralizationSet gs1) {
    System.out.print("[Generalization Set] ");
    RefOntoUML.GeneralizationSet gs2 = myfactory.createGeneralizationSet();

    DealNamedElement(gs1, gs2);

    // Add all the generalizations
    for (org.eclipse.uml2.uml.Generalization gen1 : gs1.getGeneralizations()) {
      RefOntoUML.Generalization gen2 = (RefOntoUML.Generalization) GetElement(gen1);

      // Poderia ter setado apenas um dos dois (GeneralizationSet::Generalization,
      // Generalization::GeneralizationSet), ja que sao EOpposites
      gs2.getGeneralization().add(gen2);
      gen2.getGeneralizationSet().add(gs2);
    }

    // isCovering, isDisjoint
    gs2.setIsCovering(gs1.isCovering());
    gs2.setIsDisjoint(gs1.isDisjoint());

    // They are PackageableElements, don't forget it
    RelateElements(gs1, gs2);

    return gs2;
  }
  /**
   * {@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 GeneralizationSet generalizationSet =
        (GeneralizationSet) changeLeftTarget.getLeftElement();

    final UMLGeneralizationSetChangeLeftTarget ret =
        UML2DiffFactory.eINSTANCE.createUMLGeneralizationSetChangeLeftTarget();

    for (Generalization generalization : generalizationSet.getGeneralizations()) {
      hideCrossReferences(
          generalization,
          DiffPackage.Literals.REFERENCE_CHANGE__LEFT_ELEMENT,
          ret,
          HIDING_PREDICATE,
          crossReferencer);
    }

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

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

    return ret;
  }