Package org.eclipse.xtext.resource

Examples of org.eclipse.xtext.resource.XtextResource.load()


    XtextResourceSet resourceSet = getInstanceOf(XtextResourceSet.class);
    resourceSet.setClasspathURIContext(getClass());
    XtextResource resource = (XtextResource) getInstanceOf(IResourceFactory.class).createResource(uri);
    resourceSet.getResources().add(resource);
    try {
      resource.load(input, null);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    if (resource instanceof LazyLinkingResource) {
      ((LazyLinkingResource) resource).resolveLazyCrossReferences(NullImpl);
View Full Code Here


   */
  public XtextResource createResource(URI uri, String contents) throws IOException {
    // TODO get project from URI.
    ResourceSet resourceSet = resourceSetProvider.get(projects.activeProject());
    XtextResource resource = (XtextResource) resourceSet.createResource(uri, UNSPECIFIED_CONTENT_TYPE);
    resource.load(new StringInputStream(contents), singletonMap(OPTION_ENCODING, UTF_8));
    resolveLazyCrossReferences(resource, NullImpl);
    return resource;
  }
}
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.