Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EClass


      Map<EPackage,EFactory> factories = ModelTestCase.getFactoryMap();
      for (EPackage pkg : factories.keySet()) {
        // for every class in this package
        for (EClassifier classifier : pkg.getEClassifiers()) {
          if (classifier instanceof EClass) {
            EClass cls = (EClass) classifier;
           
            // that isn't abstract
            if (!cls.isAbstract()) {
              // put this into the list
              cachedGetAllClasses.put(cls, factories.get(pkg));
            }
          }
        }
View Full Code Here


      Map<EPackage,EFactory> factories = ModelTestCase.getFactoryMap();
      for (EPackage pkg : factories.keySet()) {
        // for every class in this package
        for (EClassifier classifier : pkg.getEClassifiers()) {
          if (classifier instanceof EClass) {
            EClass cls = (EClass) classifier;
           
            // put this into the list
            cachedGetAllClassesIncludingAbstract.put(cls, factories.get(pkg));
          }
        }
View Full Code Here

          if (containment.getLowerBound() == 0 && containment.getUpperBound() == 1)
            continue;
         
          // see that all classes only belong to one containment
          if (containment.getEType() instanceof EClass) {
            EClass containmentType = (EClass) containment.getEType();
            if (containmentType.isSuperTypeOf(c)) {
              // it can contain class 'c'
              if (containmentMap.containsKey(c)) {
                // it can be contained in something else!
                String message = "Class '" + c.getName()
                  + "' can be contained twice in '"
View Full Code Here

  }
 
  private EClass findTemplateClass(EClass c0){
    if(c0!=null&&c0.getName().compareToIgnoreCase(CLASS_TEMPLATE)==0) return c0;
    for(EClass c1 : c0.getESuperTypes()){
      EClass c = findTemplateClass(c1);
      if(c!=null) return c;
    }
    return null;
  }
View Full Code Here

    return null;
  }
 
  private EAnnotation findTemplateAnnotation() throws SimTLException{
    //find superclass XFrame
    EClass templateClass = findTemplateClass(getTElement().eClass());
    if(templateClass==null) throw new InjectionException("There is no "+CLASS_TEMPLATE+" super class?!");
   
    EAnnotation ann = templateClass.getEAnnotation(ANNOTATION_TEMPLATE_CLASS);
    if(ann==null){
      throw new InjectionException("No \"" + ANNOTATION_TEMPLATE_CLASS + "\" annotation on XFrame Root");
    }
    return ann;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see sg.edu.nus.comp.xframes.xelements.XElement#load()
   */
  @Override
  protected final void load() throws SimTLException {
    EClass clazz = getTElement().eClass();
    if(hasTSuperClass(clazz, CLASS_STATMENTCONTAINER)){
      kind = ContainerKind.STATEMENT;
    } else if(hasTSuperClass(clazz, CLASS_STATMENTLISTCONTAINER)){
      kind = ContainerKind.STATEMENTLIST;
    } else if(hasTSuperClass(clazz, CLASS_MEMBERCONTAINER)){
      kind = ContainerKind.MEMBER;
    } else if(hasTSuperClass(clazz, CLASS_XJavaRootContainer)){
      kind = ContainerKind.JAVAROOT;
    } else {
      log.error("Found a container but it is not clear of which type => " + clazz.getName());
      kind = ContainerKind.NONE;
    }
    load_();
  }
View Full Code Here

          throw new SimTLException("InputModel collection doesn't contain neighbor input element. It does contain other elements though");
         
        }
       
        Reference2Element pPointerToListElement = (Reference2Element)pPointerToList;
        EClass pClass = pPointerToListElement.getReferenceToChildren().getEReferenceType();
        //create new inputElement
        EObject pElement = pClass.getEPackage().getEFactoryInstance().create(pClass);
       
       
        if(pElement==null) throw new SimTLException("Couldn't instantiate parameter element type " + pClass.getName());
       
        //Add element to parameter model
        if(parameterList.size()>1){
          //It must be a new iteration => Existing is covered in position above
          boolean insertToRightOfParam = ((NewIterationAddAllocation)grayElementAddAllocation).isInsertToRightOfParam();
View Full Code Here

  public static DataObject create(Type type)
  {
    //return (DataObject)EcoreUtil.create((EClass)type);
    if ((type instanceof EClass) && !type.isAbstract()) {
      EClass eClass = (EClass)type;
      try {
          return (DataObject)EcoreUtil.create(eClass);
      } catch (ClassCastException e) {
          throw new IllegalArgumentException();
      }
View Full Code Here

    resourceSet.setURIConverter(new SDOURIConverterImpl());
  }
 
  public static EClass createDocumentRoot()
  {
    EClass documentRootEClass = (EClass)SDOFactory.eINSTANCE.createClass();
    documentRootEClass.setName("DocumentRoot");
    ExtendedMetaData.INSTANCE.setName(documentRootEClass, "");
    ExtendedMetaData.INSTANCE.setContentKind(documentRootEClass, ExtendedMetaData.MIXED_CONTENT);
   
    EAttribute mixed = (EAttribute)SDOFactory.eINSTANCE.createAttribute();
    mixed.setName("mixed");
    mixed.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry());
    mixed.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY);
    ExtendedMetaData.INSTANCE.setName(mixed, ":mixed");
    ExtendedMetaData.INSTANCE.setFeatureKind(mixed, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE);
    documentRootEClass.getEStructuralFeatures().add(mixed);
   
    EReference xmlnsPrefixMap = (EReference)SDOFactory.eINSTANCE.createReference();
    xmlnsPrefixMap.setName("xMLNSPrefixMap");
    xmlnsPrefixMap.setEType(EcorePackage.eINSTANCE.getEStringToStringMapEntry());
    xmlnsPrefixMap.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY);
    xmlnsPrefixMap.setContainment(true);
    xmlnsPrefixMap.setTransient(true);
    ExtendedMetaData.INSTANCE.setName(xmlnsPrefixMap, "xmlns:prefix");
    ExtendedMetaData.INSTANCE.setFeatureKind(xmlnsPrefixMap, ExtendedMetaData.ATTRIBUTE_FEATURE);
    documentRootEClass.getEStructuralFeatures().add(xmlnsPrefixMap);
   
    EReference xsiSchemaLocation = (EReference)SDOFactory.eINSTANCE.createReference();
    xsiSchemaLocation.setName("xSISchemaLocation");
    xsiSchemaLocation.setEType(EcorePackage.eINSTANCE.getEStringToStringMapEntry());
    xsiSchemaLocation.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY);
    xsiSchemaLocation.setContainment(true);
    xsiSchemaLocation.setTransient(true);
    ExtendedMetaData.INSTANCE.setName(xsiSchemaLocation, "xsi:schemaLocation");
    ExtendedMetaData.INSTANCE.setFeatureKind(xsiSchemaLocation, ExtendedMetaData.ATTRIBUTE_FEATURE);
    documentRootEClass.getEStructuralFeatures().add(xsiSchemaLocation);
   
    return documentRootEClass;
  }
View Full Code Here

    List contents = new ArrayList((eDataObject).eContents());
    for (int i = 0, size = contents.size(); i < size; ++i)
    {
      ((DataObject)contents.get(i)).delete();
    }
    EClass eClass = eDataObject.eClass();
    for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i)
    {
      EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
      if (eStructuralFeature.isChangeable() && !eStructuralFeature.isDerived() && !((Property)eStructuralFeature).isReadOnly())
      {
        eDataObject.eUnset(eStructuralFeature);
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.EClass

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.