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

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


   * @param uri
   * @return
   * @throws ModelLoadException if the resource is null, or the resource contains too many elements
   */
  public static EObject load(URI uri) throws ModelLoadException {
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource resource = resourceSet.getResource(uri, true);
   
    if (resource == null)
      throw new ModelLoadException(new NullPointerException("Unexpected null resource in '" + uri + "'"));
   
    if (resource.getContents().size() != 1) {
View Full Code Here


  }

  protected void setUp() throws Exception {
    super.setUp();

    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
        .put("library", new XMLResourceFactoryImpl());
    Resource resource = resourceSet.createResource(URI
        .createURI("test.library"));

    // create a library with three books and two writers
    fixture = LibraryFactory.eINSTANCE.createLibrary();
    fixture.setName("Test Library");
View Full Code Here

  }

  protected void setUp() throws Exception {
    super.setUp();

    ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry()
        .getExtensionToFactoryMap()
        .put("library", new ResourceFactoryImpl());
    Resource resource = resourceSet.createResource(URI.createURI("test.library"));

    // create a library with three books and two writers
    fixture = LibraryFactory.eINSTANCE.createLibrary();
    fixture.setName("Test Library");
    resource.getContents().add(fixture);
View Full Code Here

   * @param f the file to load
   * @return
   * @throws ModelLoadException if the resource is null, or the resource contains too many elements
   */
  public static EObject load(File f) throws ModelLoadException {
    ResourceSet resourceSet = new ResourceSetImpl();
    URI uri = URI.createFileURI(f.getAbsolutePath());
    Resource resource = resourceSet.getResource(uri, true);
   
    if (resource == null)
      throw new ModelLoadException(new NullPointerException("Unexpected null resource in '" + f + "'"));
   
    if (resource.getContents().size() != 1) {
View Full Code Here

   * @param o
   * @return
   * @throws ModelLoadException if the resource is null, or the resource contains too many elements
   */
  public static EObject load(IFile o) throws ModelLoadException {
    ResourceSet resourceSet = new ResourceSetImpl();
    URI uri = URI.createFileURI(o.getLocation().toString());
    Resource resource = resourceSet.getResource(uri, true);
   
    if (resource == null)
      throw new ModelLoadException(new NullPointerException("Unexpected null resource in '" + o + "'"));
   
    if (resource.getContents().size() != 1) {
View Full Code Here

   * @param uri
   * @return
   * @throws ModelLoadException if the resource is null, or the resource contains too many elements
   */
  public static EObject load(URI uri) throws ModelLoadException {
    ResourceSet resourceSet = new ResourceSetImpl();
    Resource resource = resourceSet.getResource(uri, true);
   
    if (resource == null)
      throw new ModelLoadException(new NullPointerException("Unexpected null resource in '" + uri + "'"));
   
    if (resource.getContents().size() != 1) {
View Full Code Here

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

      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

      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

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

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.