Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EPackage$Descriptor


    List usedGenPackages = new ArrayList();
    GenModel genModel = null;
    ArrayList packagesToModel = new ArrayList();
    for (Iterator iter = packageList.iterator(); iter.hasNext();)
    {
      EPackage currentEPackage = (EPackage)iter.next();
      String packageNamespace  = currentEPackage.getNsURI();
      PackageInfo packageInfo  = (PackageInfo)packageInfoTable.get(packageNamespace);
      boolean bTargetPackage   = allNamespaces;
      String javaPackage       = null;
      String prefix            = null;
      String shortName         = null;
      if( packageInfo != null )
      {
        bTargetPackage = true;
        javaPackage    = packageInfo.getBasePackage();
        prefix         = packageInfo.getPrefix();
        shortName      = packageInfo.getShortName();
      }   
      String currentBasePackage = extractBasePackageName(currentEPackage, bTargetPackage ? javaPackage : null);
      String currentPrefix = bTargetPackage && prefix != null ? prefix : CodeGenUtil.capName(shortName != null ? shortName : currentEPackage.getName());
      packageInfoTable.put(currentEPackage, new PackageInfo(currentBasePackage, currentPrefix, null, null ));
     
      if( allNamespaces || packageInfo != null )
          packagesToModel.add(currentEPackage);
      else
View Full Code Here


        SDOXSDEcoreBuilder ecoreBuilder = new SDOXSDEcoreBuilder(extendedMetaData, extensibleNamespaces);

        // Add the built-in models to the targetNamespaceToEPackageMap so they
        // can't be (re)defined/overridden
        for (Iterator iter = TypeHelperImpl.getBuiltInModels().iterator(); iter.hasNext();) {
            EPackage ePackage = (EPackage)iter.next();
            ecoreBuilder.getTargetNamespaceToEPackageMap().put(ePackage.getNsURI(), ePackage);
        }

        return ecoreBuilder;
    }
View Full Code Here

            List newTypes = new ArrayList();
            for (Iterator schemaIter = model.getContents().iterator(); schemaIter.hasNext();) {
                XSDSchema schema = (XSDSchema)schemaIter.next();

                String targetNamespace = schema.getTargetNamespace();
                EPackage ePackage = extendedMetaData.getPackage(targetNamespace);
                if (extensibleNamespaces || ePackage == null || TypeHelperImpl.getBuiltInModels().contains(ePackage)) {
                    Map targetNamespaceToEPackageMap = ecoreBuilder.getTargetNamespaceToEPackageMap();
                    targetNamespaceToEPackageMap.remove(targetNamespace);

                    Collection originalEPackages = new HashSet(targetNamespaceToEPackageMap.values());
                    ecoreBuilder.generate(schema);
                    Collection newEPackages = ecoreBuilder.getTargetNamespaceToEPackageMap().values();

                    for (Iterator iter = newEPackages.iterator(); iter.hasNext();) {
                        EPackage currentPackage = (EPackage)iter.next();
                        if (!originalEPackages.contains(currentPackage)) {
                            currentPackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl());
                            EcoreUtil.freeze(currentPackage);
                            newTypes.addAll(currentPackage.getEClassifiers());
                        }
                    }
                }
            }
View Full Code Here

   * @generated NOT
   */
  public EClassifier getEClassifier(String namespaceURI, String typeName)
  {
    ExtendedMetaData extendedMetaData = getExtendedMetaData();
    EPackage ePackage = extendedMetaData.getPackage(namespaceURI);
    if (ePackage != null)
    {
      EClassifier eClassifier = ePackage.getEClassifier(typeName);
      if (eClassifier == null)
      {
        eClassifier = extendedMetaData.getType(ePackage, typeName);
      }
      return eClassifier;
View Full Code Here

    static public EPackage.Registry getBuiltInModelRegistry() {
        if (builtInModelRegistry == null) {
            EPackageRegistryImpl registry = new EPackageRegistryImpl();
            for (Iterator iter = TypeHelperImpl.getBuiltInModels().iterator(); iter.hasNext();) {
                EPackage ePackage = (EPackage)iter.next();
                registry.put(ePackage.getNsURI(), ePackage);
            }
           
            registry.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
            registry.put(XMLTypePackage.eNS_URI, XMLTypePackage.eINSTANCE);
            registry.put(ChangePackage.eNS_URI, ChangePackage.eINSTANCE);
View Full Code Here

  }

  public EPackage getPackage(String namespace)
  {
    if ("".equals(namespace)) namespace = null; //FB
    EPackage result = registry.getEPackage(namespace);
    return result == null ? super.getPackage(namespace) : result;
  }
View Full Code Here

  public EPackage getEPackage(XSDNamedComponent xsdNamedComponent) {
    XSDSchema containingXSDSchema = xsdNamedComponent.getSchema();
    String targetNamespace = containingXSDSchema == null ?
        xsdNamedComponent.getTargetNamespace() : containingXSDSchema.getTargetNamespace();
    EPackage ePackage = (EPackage) targetNamespaceToEPackageMap.get(targetNamespace);
    if (ePackage != null)
      return ePackage;
    ePackage = super.getEPackage(xsdNamedComponent);
    String nsPrefix = lookupPrefix(xsdNamedComponent.getElement(), targetNamespace);
    if (nsPrefix != null)
      ePackage.setNsPrefix(nsPrefix);
    return ePackage;
  }
View Full Code Here

      if (rootSchema.getSchemaForSchemaNamespace().equals(xsdTypeDefinition.getTargetNamespace())) {
        eClassifier =
          getBuiltInEClassifier(xsdTypeDefinition.getURI(), xsdTypeDefinition.getName());
      }
      else if (xsdTypeDefinition.getContainer() == null) {
        EPackage pkg = extendedMetaData.getPackage(xsdTypeDefinition.getTargetNamespace());
        if(pkg != null) {
          eClassifier = pkg.getEClassifier(xsdTypeDefinition.getName());
        }
      }
    }
    if (eClassifier == null) {
      eClassifier = super.getEClassifier(xsdTypeDefinition);
View Full Code Here

    return n1 == null && n2 == null;
  }
 
  protected void removeDuplicateEClassifier(EClassifier eClassifier, XSDTypeDefinition xsdTypeDefinition)
  {
    EPackage ePackage = eClassifier.getEPackage();
    List eClassifiers = ePackage.getEClassifiers();
    String name = eClassifier.getName();
    int size = eClassifiers.size();
    for (int index = eClassifiers.indexOf(eClassifier); ++index < size; )
    {
      EClassifier nextEClassifier = (EClassifier)eClassifiers.get(index);
View Full Code Here

    }
  }
 
  public EClass computeEClass(XSDComplexTypeDefinition xsdComplexTypeDefinition) {
    if (xsdComplexTypeDefinition == null) return super.computeEClass(xsdComplexTypeDefinition);
    EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(xsdComplexTypeDefinition.getTargetNamespace());
    if (ePackage != null && TypeHelperImpl.getBuiltInModels().contains(ePackage)) {
      EClassifier eclassifier = ePackage.getEClassifier(xsdComplexTypeDefinition.getName());
      if (eclassifier != null) return (EClass)eclassifier;
    }
    EClass eClass = super.computeEClass(xsdComplexTypeDefinition);
    if (replaceConflictingTypes) removeDuplicateEClassifier(eClass, xsdComplexTypeDefinition);
    String aliasNames = getEcoreAttribute(xsdComplexTypeDefinition.getElement(), "aliasName");
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.EPackage$Descriptor

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.