public static void setValue(
     final IPreferenceStore store, final String name, final AggregationKind value) {
   final AggregationKind oldValue = getAggregationKind(store, name);
   if (oldValue == null || !oldValue.equals(value)) {
     store.putValue(name, asString(value));
     store.firePropertyChangeEvent(name, oldValue, value);
   }
 }
Esempio n. 2
0
  public RefOntoUML.Association DealAssociationStereotype(org.eclipse.uml2.uml.Association a1) {
    System.out.print("<Association> ");
    RefOntoUML.Association a2 = null;

    if (a1.getAppliedStereotypes().size() == 1) {
      org.eclipse.uml2.uml.Stereotype s = a1.getAppliedStereotypes().get(0);

      System.out.print("<<" + s.getName() + ">> ");
      String stereoname = s.getName();

      if (stereoname.compareTo("Formal") == 0) {
        a2 = myfactory.createFormalAssociation();
      } else if (stereoname.compareTo("Material") == 0) {
        a2 = myfactory.createMaterialAssociation();
      } else if (stereoname.compareTo("Mediation") == 0) {
        a2 = myfactory.createMediation();
      } else if (stereoname.compareTo("Derivation") == 0) {
        a2 = myfactory.createDerivation();
      } else if (stereoname.compareTo("Characterization") == 0) {
        a2 = myfactory.createCharacterization();
      } else if (stereoname.compareTo("componentOf") == 0) {
        a2 = myfactory.createcomponentOf();
      } else if (stereoname.compareTo("memberOf") == 0) {
        a2 = myfactory.creatememberOf();
      } else if (stereoname.compareTo("subCollectionOf") == 0) {
        a2 = myfactory.createsubCollectionOf();
      } else if (stereoname.compareTo("subQuantityOf") == 0) {
        a2 = myfactory.createsubQuantityOf();
      }

      if (a2 instanceof RefOntoUML.Meronymic) {
        boolean isShareable = (Boolean) a1.getValue(s, "isShareable");
        boolean isEssential = (Boolean) a1.getValue(s, "isEssential");
        boolean isInseparable = (Boolean) a1.getValue(s, "isInseparable");
        boolean isImmutablePart = (Boolean) a1.getValue(s, "isImmutablePart");
        boolean isImmutableWhole = (Boolean) a1.getValue(s, "isImmutableWhole");

        ((RefOntoUML.Meronymic) a2).setIsShareable(isShareable);
        ((RefOntoUML.Meronymic) a2).setIsEssential(isEssential);
        ((RefOntoUML.Meronymic) a2).setIsInseparable(isInseparable);
        ((RefOntoUML.Meronymic) a2).setIsImmutablePart(isImmutablePart);
        ((RefOntoUML.Meronymic) a2).setIsImmutableWhole(isImmutableWhole);
      }
    } else if (a1.getAppliedStereotypes().size() == 0) {
      org.eclipse.uml2.uml.Property memberEnd2 = a1.getMemberEnds().get(1);
      org.eclipse.uml2.uml.AggregationKind ak = memberEnd2.getAggregation();

      if (ak.getValue() == org.eclipse.uml2.uml.AggregationKind.NONE) {
        a2 = myfactory.createAssociation();
      } else {
        a2 = myfactory.createcomponentOf();
      }
    }

    DealAssociation(a1, a2);
    return a2;
  }
Esempio n. 3
0
  public void DealProperty(org.eclipse.uml2.uml.Property p1, RefOntoUML.Property p2) {
    System.out.print(
        "    Property ("
            + p1.getType().getName()
            + "): "
            + p1.getLower()
            + " "
            + p1.getUpper()
            + " ");

    DealNamedElement(p1, p2);

    // isLeaf (RedefinableElement)
    p2.setIsLeaf(p1.isLeaf());
    // isStatic (Feature)
    p2.setIsStatic(p1.isStatic());
    // isReadOnly (StructuralFeature)
    p2.setIsReadOnly(p1.isReadOnly());

    // lower, upper (MultiplicityElement)
    RefOntoUML.LiteralInteger lowerValue = myfactory.createLiteralInteger();
    RefOntoUML.LiteralUnlimitedNatural upperValue = myfactory.createLiteralUnlimitedNatural();
    lowerValue.setValue(p1.getLower());
    upperValue.setValue(p1.getUpper());

    p2.setLowerValue(lowerValue);
    p2.setUpperValue(upperValue);

    // Type (TypedElement)
    RefOntoUML.Type t2 = (RefOntoUML.Type) GetElement(p1.getType());
    p2.setType(t2);

    // isDerived
    p2.setIsDerived(p1.isDerived());

    // aggregation
    org.eclipse.uml2.uml.AggregationKind ak1 = p1.getAggregation();

    if (ak1.getValue() == org.eclipse.uml2.uml.AggregationKind.NONE) {
      p2.setAggregation(RefOntoUML.AggregationKind.NONE);
    } else if (ak1.getValue() == org.eclipse.uml2.uml.AggregationKind.SHARED) {
      p2.setAggregation(RefOntoUML.AggregationKind.SHARED);
    } else if (ak1.getValue() == org.eclipse.uml2.uml.AggregationKind.COMPOSITE) {
      p2.setAggregation(RefOntoUML.AggregationKind.COMPOSITE);
    }
  }
 private static String asString(final AggregationKind value) {
   return value == null ? null : value.getName();
 }
 public static AggregationKind getAggregationKind(
     final IPreferenceStore store, final String name) {
   return AggregationKind.getByName(store.getString(name));
 }
 public static void setDefault(
     final IPreferenceStore store, final String name, final AggregationKind value) {
   store.setDefault(name, value.getName());
 }