Examples of ResourceSetImpl


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

   * @returns the active editor part
   * @throws Exception
   */
  protected IEditorPart loadDiagramFile(IFile diagramFile) throws Exception {
    // try loading it up with Eclipse
    ResourceSet resSet = new ResourceSetImpl();         
    Resource res = resSet.getResource(URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), false), true);
    assertTrue("can load new editor", IamlDiagramEditorUtil.openDiagram( res ));
   
    // get the active workbench editor part
    // based on IamlDiagramEditorUtil#openDiagram()
    IWorkbenchPage page = PlatformUI.getWorkbench()
View Full Code Here

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

      throw new IllegalArgumentException("Diagram file " + diagramFile + " should not exist yet");

    // initialize model file
    // based on generated IamlNewDiagramFileWizard#performFinish
    // based on generated IamlInitDiagramFileAction#run
    ResourceSet resourceSet = new ResourceSetImpl();
    URI sourceModelURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), false);
    URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), false);
    final Resource modelResource = resourceSet.getResource(sourceModelURI, true);
    final Resource diagramResource = resourceSet.createResource(diagramModelURI);
    final EObject modelRoot = (EObject) modelResource.getContents().get(0);
   
    List<Object> affectedFiles = new LinkedList<Object>();
    affectedFiles.add(diagramFile);
    TransactionalEditingDomain myEditingDomain = GMFEditingDomainFactory.INSTANCE
View Full Code Here

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

      monitor.subTask("Loading target diagram " + targetDiagram.getName());
     
      // we need to load this model diagram
      // based on EclipseTestCase#loadDiagramFile(IFile)
      // try loading it up with Eclipse
      ResourceSet resSet = new ResourceSetImpl();         
      Resource res = resSet.getResource(URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), false), true);
      IamlDiagramEditorUtil.openDiagram( res );
     
      // get the active workbench editor part
      // based on IamlDiagramEditorUtil#openDiagram()
      IWorkbenchPage page = PlatformUI.getWorkbench()
View Full Code Here

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

   */
  public void testInitial() throws Exception {
    copyFiles();
   
    // 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

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

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

  /**
   * 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

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

  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

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

    // 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

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

   
    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

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

   *
   * @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
TOP
Copyright © 2018 www.massapi.com. 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.