Package org.eclipse.emf.ecore.resource.impl

Examples of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl


    // do the phantom edges action
    RemovePhantomEdgesAction act = new RemovePhantomEdgesAction();
    act.doExecute(targetModel, new NullProgressMonitor());

    // try and load the file directly
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(targetModel.getFullPath().toString(), false), true);   
    InternetApplication model = (InternetApplication) resource.getContents().get(0);
   
    // get the Frame
    assertEquals(0, model.getIterators().size());
    assertEquals(0, model.getLoginHandlers().size());
View Full Code Here


  /**
   * Load a model file directly.
   * Assumes that it will only contain one element (and tests this with JUnit).
   */
  protected EObject loadModelDirectly(String filename) {
    ResourceSet resourceSet = new ResourceSetImpl();
    URI uri = URI.createFileURI(filename);
    Resource resource = resourceSet.getResource(uri, true);
    assertNotNull(resource);
    assertEquals("there should only be one contents in the model file", 1, resource.getContents().size());
    return resource.getContents().get(0);
  }
View Full Code Here

  public IStatus doExecute(IFile o, IProgressMonitor monitor) throws InferenceException, IOException, CoreException {
    monitor.beginTask("Verifying model '" + o.getName() + "'", 10);
   
    monitor.subTask("Loading model");
    // try and load the file directly
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource resource = resourceSet.getResource(URI.createFileURI(o.getLocation().toString()), true);
   
    // we can only do one model
    if (resource.getContents().size() != 1) {
      return new Status(IStatus.ERROR, PLUGIN_ID, "Could not transform model: unexpected number of model elements in file (expected: 1, found: " + resource.getContents().size() + ")");
    }
View Full Code Here

    // first, translate HTML to LaTeX
    testTranslateHTMLToLaTeX();
   
    EObject root = createDocumentation();
   
    ResourceSet resourceSet = new ResourceSetImpl();
    File modelFile = new File("test.modeldoc");
        URI fileURI = URI.createFileURI(modelFile
                .getAbsolutePath());
        Resource resource = resourceSet.createResource(fileURI);
        resource.getContents().add(root);
        resource.save(Collections.EMPTY_MAP);
     
    // generate code
    ModeldocCodeGenerator codegen = new ModeldocCodeGenerator();
View Full Code Here

   
    EMFClass c = ModeldocFactory.eINSTANCE.createEMFClass();
    c.setTargetClass(page);

    {
      ResourceSet resourceSet = new ResourceSetImpl();
          URI fileURI = URI.createFileURI(new File("test.modeldoc")
                  .getAbsolutePath());
          Resource resource = resourceSet.createResource(fileURI);
          resource.getContents().add(c);
          resource.save(Collections.EMPTY_MAP);
    }
       
        // try loading it!
    EMFClass c2 = null;
    {
      ResourceSet resourceSet = new ResourceSetImpl();
          URI fileURI = URI.createFileURI(new File("test.modeldoc")
                  .getAbsolutePath());
          Resource resource = resourceSet.getResource(fileURI, true);
          c2 = (EMFClass) resource.getContents().get(0);
    }
   
    assertEquals(page, c2.getTargetClass());
    System.out.println(c2.getTargetClass());
View Full Code Here

   *
   * @param file
   */
  public InternetApplication createNewInternetApplication(File file) {

    ResourceSet resourceSet = new ResourceSetImpl();
    URI uri = URI.createFileURI(file.getAbsolutePath());
    Resource resource = resourceSet.createResource(uri);
    assertNotNull(resource);
    assertEquals("The new model should be empty.", 0, resource.getContents().size());

    // create a new object
    InternetApplication a = ModelFactory.eINSTANCE.createInternetApplication();
View Full Code Here

   * @param filename the filename to save to, e.g. <code>foo.iaml</code>
   * @return
   * @throws IOException
   */
  protected File saveToFile(EObject model, String filename) throws IOException {
    ResourceSet resourceSet = new ResourceSetImpl();
    File modelFile = new File(filename);
        URI fileURI = URI.createFileURI(modelFile
                .getAbsolutePath());
        Resource resource = resourceSet.createResource(fileURI);
        resource.getContents().add(model);
        resource.save(Collections.EMPTY_MAP);
       
        return modelFile;
  }
View Full Code Here

   * some {@link ResourceSet}.
   *
   * @return a new, empty InternetApplication
   */
  private InternetApplication createInternetApplication() {
    ResourceSet set = new ResourceSetImpl();
    URI uri = URI.createFileURI("queue.iaml");
    Resource resource = set.createResource(uri);
   
    // create the model
    InternetApplication root = ModelFactory.eINSTANCE.createInternetApplication();
    assertNotNull(root);
    assertNotEqual(root.getName(), "created successfully");
View Full Code Here

   *
   * <p>If "A registered resource factory is needed" is thrown, add the
   * <code>org.eclipse.emf.ecore.xmi</code> plugin as a dependency.</p>
   */
  protected EObject loadModelDirectly(String filename) {
    ResourceSet resourceSet = new ResourceSetImpl();
    URI uri = URI.createFileURI(filename);
    Resource resource = resourceSet.getResource(uri, true);
    assertNotNull(resource);
    assertEquals("there should only be one contents in the model file", 1, resource.getContents().size());
    return resource.getContents().get(0);
  }
View Full Code Here

    map.put("xmi", new XMIResourceFactoryImpl());
    map.put("ecore", new  XMIResourceFactoryImpl());
   
    EPackage.Registry.INSTANCE.put("http://www.emftext.org/java/", JavaPackage.eINSTANCE);
   
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource umlMetamodel = resourceSet.createResource(
        InterpreterTest.resolveURI(URI.createURI("file://input/Metamodel_uml.ecore")));
    if(!umlMetamodel.isLoaded()){
      log.debug("Loading Parameter-metamodel" + umlMetamodel.getURI().toString());
      umlMetamodel.load(Collections.EMPTY_MAP);
      while(!umlMetamodel.isLoaded()){
        Thread.yield();
      }
      log.debug("isLoaded");
    }
    resourceSet.getPackageRegistry().put("http://www.reuseware.org/metamodel_uml", umlMetamodel.getContents().get(0));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.resource.impl.ResourceSetImpl

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.