Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.Classifier


    assertEquals("Data::datatype::String", results.get(0));
  }

  @Test
  public void testGetTemplateParameterSubstitutionPrimitiveType() {
    Classifier clazzifier = prepareMocks();

    when(dataTypeUtils.isPrimitiveType(Mockito.anyString())).thenReturn(
        true);
    when(clazzifier.getName()).thenReturn("Data::datatype::Integer");
    when(clazzifier.getQualifiedName()).thenReturn(
        "Data::datatype::de::test::Integer");

    List<String> results = umlHelper.getTemplateParameterSubstitution(type);

    assertEquals("Data::datatype::Integer", results.get(0));
View Full Code Here


    assertEquals("Data::datatype::Integer", results.get(0));
  }

  @Test
  public void testCheckParameterizedTypeForTemplateParameterSubstitution() {
    Classifier clazzifier = prepareMocks();

    when(type.getName()).thenReturn("Data::datatype::Collection<Integer>");
    when(type.getQualifiedName()).thenReturn(
        "Data::datatype::Collection<Integer>");

    when(dataTypeUtils.isPrimitiveType(Mockito.anyString())).thenReturn(
        true);
    when(clazzifier.getName()).thenReturn("Integer");
    when(clazzifier.getQualifiedName()).thenReturn(
        "Data::datatype::de::test::Integer");

    Map<String, String> results = umlHelper
        .checkParameterizedTypeForTemplateParameterSubstitution(type);
View Full Code Here

    Iterator<TemplateParameterSubstitution> iteratorTemplateParameterSubstitution = mock(Iterator.class);
    TemplateParameterSubstitution templateParameterSubstitution = mock(
        TemplateParameterSubstitution.class,
        Answers.RETURNS_DEEP_STUBS.get());

    Classifier clazzifier = mock(Classifier.class);

    // Prepare...
    when(type.allOwnedElements()).thenReturn(elements);
    when(elements.iterator()).thenReturn(iteratorElement);
    when(iteratorElement.hasNext()).thenReturn(true, false);
View Full Code Here

            .getParameterSubstitutions();
        for (TemplateParameterSubstitution templateParameterSubstitution : subs) {
          ParameterableElement paramElement = templateParameterSubstitution
              .getActual();
          if (paramElement instanceof Classifier) {
            Classifier clazzifier = (Classifier) paramElement;
            if (!dataTypeUtils
                .isPrimitiveType(clazzifier.getName())
                && !dataTypeUtils.isJavaType(clazzifier
                    .getName())) {
              results.add(clazzifier.getQualifiedName());
            } else {
              results.add(clazzifier.getName());
            }
          }
        }
      }
    }
View Full Code Here

   */
  public void createAssociatedStereotype(Element e, String profileQualifiedName, String stereotypeName) {

    applySysMLProfile(e.getModel(), profileQualifiedName);

    final Element element = e;
    final String stereotypeQualifiedName = profileQualifiedName + "::" + stereotypeName;

    final Stereotype stereotype = element.getApplicableStereotype(stereotypeQualifiedName);
    final EList<Stereotype> appliedStereotypes = element.getAppliedStereotypes();

    if (stereotype == null) {
      final String message = "Can't apply the setereotype " + stereotypeQualifiedName + " on "
          + element.toString();
      Activator.log(Status.WARNING, message, null);
    } else if (appliedStereotypes != null && appliedStereotypes.contains(stereotype)) {
      final String message = "The stereotype " + stereotype.getQualifiedName()
          + " is already applied on " + element.toString();
      Activator.log(Status.INFO, message, null);
    } else {
      element.applyStereotype(stereotype);
    }
  }
View Full Code Here

   *            : the given element for which you want to delete the stereotype.
   * @param steQualified
   *            : the qualified name of the stereotype you want to delete (ex. : SysML::Blocks::Block).
   */
  public void deleteAssociatedStereotype(Element e, String steQualified) {
    final Element element = e;

    if (element != null && steQualified != null) {
      final Stereotype stereotype = element.getAppliedStereotype(steQualified);
      if (stereotype != null) {
        element.unapplyStereotype(stereotype);
      }
    } else {
      final String message = "Can't delete the stereotype application because the element or the stereotypeName keys are not correct";
      Activator.log(Status.INFO, message, null);
    }
View Full Code Here

    deleteAssociatedStereotype(e, SYSML_REQUIREMENT);
    final EObject root = getRootContainer(e);
    for (final Iterator<EObject> iterator = root.eAllContents(); iterator.hasNext();) {
      final EObject object = iterator.next();
      if (object instanceof Abstraction) {
        final Element supplier = ((Abstraction)object).getSupplier(e.getName());
        if (supplier != null) {
          Stereotype s = ((Abstraction)object).getAppliedStereotype("SysML::Requirements::Satisfy");
          if (s != null) {
            deleteAssociatedStereotype((Abstraction)object, "SysML::Requirements::Satisfy");
          } else {
View Full Code Here

      parentProfile = Activator.getSysMLProfile();
    } else if (profileQualifiedName.startsWith("Standard")) {
      parentProfile = Activator.getStandardProfile();
    }

    Package profilePackage = parentProfile;

    final String[] profiles = profileQualifiedName.split(":{2}");
    // search the profile in the package hierarchy
    for (int index = 1; index < profiles.length - 1; index++) {
      profilePackage = profilePackage.getNestedPackage(profiles[index]);
    }

    Profile profile = (Profile)profilePackage;

    if (profileQualifiedName.startsWith("SysML")) {
      profile = (Profile)profilePackage.getNestedPackage(profiles[profiles.length - 1]);
    }

    if (profile == null) {
      final String message = "Can't apply the profile " + profileQualifiedName + " on "
          + p.getQualifiedName();
View Full Code Here

   */
  private static Boolean isProfileApplied(Package currentPackage, String profileQualifiedName) {
    final EList<Profile> allProfiles = currentPackage.getAllAppliedProfiles();
    final Iterator<Profile> it = allProfiles.iterator();
    while (it.hasNext()) {
      Profile cur = it.next();
      if (profileQualifiedName.equalsIgnoreCase(cur.getQualifiedName()))
        return true;
    }
    return false;
  }
View Full Code Here

   * <!-- begin-user-doc --> <!-- end-user-doc -->
   *
   * @generated
   */
  public void setBase_Property(Property newBase_Property) {
    Property oldBase_Property = base_Property;
    base_Property = newBase_Property;
    if(eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONSTRAINT_PROPERTY__BASE_PROPERTY, oldBase_Property, base_Property));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.uml2.uml.Classifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.