Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EClass


      String modelID, String metaHref) throws Exception {

    // first, lets get the EClass of the meta element
    String metaElementName = metaHref.substring(metaHref.lastIndexOf("/") + 1);
    // resolve
    EClass meta = resolveSimpleEClass(metaElementName);
   
    // and now lets find the EClass of the editor
    EClass editor = getEditorEClass(filename, modelID);
   
    assertNotNull(meta);
    assertNotNull(editor);
   
    // the meta element should be a subclass of the editor
    assertTrue(filename + ": Element '" + metaHref + "' is not a subclass of diagram type '" + modelID + "' [resolved meta = '" + meta + "', editor = '" + editor + "']",
        editor.isSuperTypeOf(meta));
  }
View Full Code Here


       
        String href = domainDiagramElement.getAttribute("href");
        // trim to last /
        href = href.substring(href.lastIndexOf("/") + 1);
       
        EClass result = resolveSimpleEClass(href);
        foundClasses.put(modelID, result);
        return result;
      }     
    }
   
View Full Code Here

   
    for (EPackage pkg : ModelTestCase.getFactoryMap().keySet()) {
      EClassifier cf = pkg.getEClassifier(metaElementName);
      if (cf != null && cf instanceof EClass) {
        // found it!
        EClass result = (EClass) cf;
        resolvedClasses.put(metaElementName, result);
        return result;
      }
    }
    fail("Could not resolve simple EClass name '" + metaElementName + "'");
View Full Code Here

       
        String href = domainDiagramElement.getAttribute("href");
        // trim to last /
        href = href.substring(href.lastIndexOf("/") + 1);
         
        EClass rootElement = resolveSimpleEClass(href);

        rootElements.add(new RootElementPair(rootElement, modelID, filename));
      }
    });
   
    // and then check all gmfgens that these root elements are coorect
    iterate(new DefaultIterator() {
     
      @Override
      public void execute2(String filename, Document doc) throws Exception {
        // will do both links and nodes
        IterableElementList nodes = xpath(doc, "/GenEditorGenerator/diagram/topLevelNodes");
        nodes.addAll(xpath(doc, "/GenEditorGenerator/diagram/links"));
        assertFalse(filename + ": No nodes found", nodes.isEmpty());
       
        boolean changed = false;
        for (Element node : nodes) {
          // find the meta element for this node
          Element meta = xpathFirst(node, "modelFacet/metaClass");
          // iaml.genmodel#//model/CompositeOperation
          String metaHref = meta.getAttribute("href");
          // CompositeOperation
          metaHref = metaHref.substring(metaHref.lastIndexOf("/") + 1);
         
          EClass metaElement = resolveSimpleEClass(metaHref);
         
          try {
            RootElementPair pair = getBestPair(rootElements, metaElement);
           
            if (pair == null)
View Full Code Here

  /**
   * Tests {@link #getBestPair(List, EClass)}.
   */
  public void testGetBestPair() {
    EClass domain_schema = DomainPackage.eINSTANCE.getDomainType();
    EClass role = UsersPackage.eINSTANCE.getRole();
   
    List<RootElementPair> elements = new ArrayList<RootElementPair>();
   
    // only DomainSchema
    elements.add(new RootElementPair(domain_schema, null, null));   
View Full Code Here

       
      String href = domainDiagramElement.getAttribute("href");
      // trim to last /
      href = href.substring(href.lastIndexOf("/") + 1);
       
      EClass rootElement = resolveSimpleEClass(href);
     
      assertAllOpenableElements(modelID, rootElement);
    }
  }
View Full Code Here

        // iaml.genmodel#//model/CompositeOperation
        String metaHref = meta.getAttribute("href");
        // CompositeOperation
        metaHref = metaHref.substring(metaHref.lastIndexOf("/") + 1);
       
        EClass metaElement = resolveSimpleEClass(metaHref);
       
        if (rootElement.isSuperTypeOf(metaElement)) {
          // there must be a behaviour for this meta element!
          boolean found = false;
         
          IterableElementList beh = xpath(node, "behaviour");
          String foundType = null;
          for (Element b : beh) {
            if (b.getAttribute("xsi:type").equals("gmfgen:OpenDiagramBehaviour")) {
              // found it directly
              foundType = b.getAttribute("diagramKind");
              if (b.getAttribute("diagramKind").equals(modelID)) {
                found = true;
              }
             
              // sometimes we can have multiple editors for subclasses, e.g.
              // a generic ApplicationElement editor, and a more specific
              // DomainObject editor. in this case, we need to still
              // make sure that we mark this as found when searching for
              // ApplicationElement editors
              if (!found) {
                // e.g. DomainObject
                EClass actual = getEditorEClass(filename, b.getAttribute("diagramKind"));
                if (rootElement.isSuperTypeOf(actual)) {
                  // a valid subclass
                  found = true;
                }
              }
View Full Code Here

   
    Map<EPackage,EFactory> factories = ModelTestCase.getFactoryMap();
    for (EPackage pkg : factories.keySet()) {
      for (EClassifier classifier : pkg.getEClassifiers()) {
        if (classifier instanceof EClass) {
          EClass cls = (EClass) classifier;
         
          // ignore abstract classes
          if (cls.isAbstract())
            continue;
         
          // ignore interface classes
          if (cls.isInterface())
            continue;
         
          // ignored classes
          if (IGNORED_CLASSES.contains(cls))
            continue;
         
          // check that a .png file exists
          File f = new File(TARGET_PROJECT + cls.getName() + ".png");
          if (!f.exists()) {
            missing.add(cls.getName());
          }
        }
      }
    }
   
View Full Code Here

    return types.size();
  }

  @Override
  public int get(EObject obj) {
    EClass type = obj.eClass();
    if (!types.contains(type)) {
      types.add(type);
    }
    return 0// ignored
  }
View Full Code Here

   
    int done = 0;
    for (EClassifier c : classes) {
      // instantiate all non-abstract classes in this package
      if (c instanceof EClass && !((EClass) c).isAbstract()) {
        EClass target = (EClass) c;
       
        // we should know of the factory to create the model element
        EFactory factory = getFactoryMap().get( target.getEPackage() );
        assertNotNull("Couldn't find a factory for package: " + target.getEPackage(), factory);
        EObject obj;
        try {
          obj = factory.create( target );
        } catch (IllegalArgumentException e) {
          throw new RuntimeException("Could not create '" + target + "' in EPackage '" + target.getEPackage() + "' from factory: " + factory, e);
        }
       
        if (obj instanceof GeneratedElement) {
          GeneratedElement ge = (GeneratedElement) obj;
         
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.