Package org.eclipse.emf.ecore.resource.Resource

Examples of org.eclipse.emf.ecore.resource.Resource.Factory


  public Factory getFactory(URI uri)
  {
    /*return getFactory(uri, null);*/
    String uriString = uri.toString();

    Factory factory = parent.getFactory(uri);
    Factory defaultFactory = (Factory)INSTANCE.getFactory(URI.createURI(DEFAULT_EXTENSION));

    // give the parent the first crack at getting the factory
    // if the factory is null or the known 'default' factory then we'll
    // try to compute the factory ourselves
    if (factory == null || factory == defaultFactory)
View Full Code Here


   * .rb resource that is not expected to contribute anything to the pptp. All non null resources are added to the
   * resource set.
   */
  public Resource loadResource(InputStream in, URI uri) throws Exception {
    // Lookup the factory to use for the resource
    Factory factory = Resource.Factory.Registry.INSTANCE.getFactory(uri);
    // // UGLY AS HELL HACK
    // if(factory instanceof XtextResourceFactory)
    // factory = injector.getInstance(XtextResourceFactory.class);

    // Avoid loading lots of empty resources for rb files that do not
    // contribute
    if(factory instanceof PptpRubyResourceFactory && !pptpRubyResourceServiceProvider.canHandle(uri))
      return null;

    Map<String, String> options = Maps.newHashMap();
    options.put(XtextResource.OPTION_ENCODING, getEncodingProvider().getEncoding(uri));

    Resource r = factory.createResource(uri);
    resourceSet.getResources().add(r);
    r.load(in, options);

    return r;
  }
View Full Code Here

   * Returns null for a .rb resource that is not expected to contribute anything to the pptp.
   * All non null resources are added to the resource set.
   */
  public Resource loadResource(InputStream in, URI uri) throws Exception {
    // Lookup the factory to use for the resource
    Factory factory = Resource.Factory.Registry.INSTANCE.getFactory(uri);

    Map<String, String> options = Maps.newHashMap();
    options.put(XtextResource.OPTION_ENCODING, "UTF8");

    Resource r = factory.createResource(uri);
    resourceSet.getResources().add(r);
    r.load(in, options);

    return r;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.resource.Resource.Factory

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.