Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.Package


    Element root = (Element)modelResource.getContents().get(0);

    if(root instanceof Package) {

      // Import model library
      Package modelToImport = (Package)(modelResource.getContents().get(0));
      // create import package
      PackageImport modelImport = UMLFactory.eINSTANCE.createPackageImport();
      modelImport.setImportedPackage(modelToImport);

      return currentModel.getPackageImports().add(modelImport);
View Full Code Here


   * @param pkg
   *       Any package of the current UML diagram.
   * @return List<Package> packageList - A complete list of the packages of the current UML diagram.
   */
  public static List<Package> getAllPackages(Package pkg) {
    Package rootPkg = findRootPackage(pkg);
    List<Package> pkgList = new ArrayList<Package>();
    pkgList.add(rootPkg);
    pkgList.addAll(getAllSubPackages(rootPkg));
    return pkgList;
  }
View Full Code Here

    }
    return subPkgs;
  }
 
  private static Package findRootPackage(Package pkg) {
    Package rootPkg = pkg;
    while (rootPkg.allOwningPackages().size() > 1) {
      rootPkg = rootPkg.getNestingPackage();
    }
    return rootPkg;
  }
View Full Code Here

  /*
   * Removes the prefix "PrimitiveTypes" from Type
   */
  private void removePrimitiveTypesPkgName(Type pType) {
    if (pType != null) {
      Package impl = pType.getPackage();
      if (impl.getName().equals("PrimitiveTypes")) {
        System.out.println(pType.getName() + " - " + impl.getName());
        impl.setName("");
      }
    }
  }
View Full Code Here

       
        final org.eclipse.uml2.uml.Package finalTopPackage = topPackage;
       
        //test the presence of the "ProxyRequirement" Package
       
        Package proxyPackage = (Package)topPackage.getPackagedElement(PROXY_PACKAGE_NAME);
       
        //test if already present, if not need creation
       
        if (proxyPackage == null){
          //means that the package have to be created
         
          RecordingCommand PackCMD = new RecordingCommand(domain) {
           
            @Override
            protected void doExecute() {
              org.eclipse.uml2.uml.Package tempPackage = UMLFactory.eINSTANCE.createPackage();
              tempPackage.setName(PROXY_PACKAGE_NAME);
              finalTopPackage.getPackagedElements().add(tempPackage);
            }
          };
         
          domain.getCommandStack().execute(PackCMD);
         
        }
       
        final Package finalProxyPackage = (Package)topPackage.getPackagedElement(PROXY_PACKAGE_NAME);
       
        RecordingCommand ReqCMD = new RequirementCreateCommand(domain, finalProxyPackage, requirement.getIdentifier(), requirement.getDesc());
       
        domain.getCommandStack().execute(ReqCMD);
       
        org.eclipse.uml2.uml.Class proxyreq = (org.eclipse.uml2.uml.Class)finalProxyPackage.getPackagedElement(requirement.getIdentifier());
       
        RecordingCommand SatCMD = new SatisfyCreateCommand(domain, (NamedElement)UmlElement, (NamedElement)proxyreq, trace.getIdentifier());
       
        domain.getCommandStack().execute(SatCMD);
   
View Full Code Here

   *            full qualified name for
   * @return The full qualified name as <code>java.lang.String</code>
   */
  public String getFQNPackageName(Type type) {
    String pn = "";
    Package p = findNearestPackage(type);
    while (p != null) {
      pn = p.getName() + "." + pn;
      p = findNearestPackage(p);
    }
    if (pn.endsWith(".")) {
      pn = pn.substring(0, pn.length() - 1);
    }
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

   *            : the profile qualified name you want to apply.
   */
  private void applySysMLProfile(Package p, String profileQualifiedName) {
    if (isProfileApplied(p, profileQualifiedName))
      return;
    Profile parentProfile = null;
    if (profileQualifiedName.startsWith("SysML")) {
      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]);
    }

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

    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

TOP

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

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.