use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class RichStringProcessorTest method richStringWithError.
protected RichString richStringWithError(String string) throws Exception {
XtextResourceSet set = getResourceSet();
String fileName = getFileName(string);
Resource resource = set.createResource(URI.createURI(fileName + ".xtend"));
resource.load(new StringInputStream(getPrefix() + string + "}"), null);
XtendFile file = (XtendFile) resource.getContents().get(0);
XtendClass clazz = (XtendClass) file.getXtendTypes().get(0);
XtendFunction function = (XtendFunction) clazz.getMembers().get(0);
return (RichString) function.getExpression();
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class TypeProviderErrorTest method file.
@Override
protected XtendFile file(String string, boolean validate) throws Exception {
if (validate)
return super.file(string, validate);
XtextResourceSet set = getResourceSet();
String fileName = getFileName(string);
Resource resource = set.createResource(URI.createURI(fileName + ".xtend"));
resource.load(new StringInputStream(string), null);
XtendFile file = (XtendFile) resource.getContents().get(0);
return file;
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class XtendValidationTest method testBug378211_NoException.
@Test
public void testBug378211_NoException() throws Exception {
String model = "@Data class Foo { int id def }";
XtextResourceSet set = getResourceSet();
String fileName = getFileName(model);
Resource resource = set.createResource(URI.createURI(fileName + ".xtend"));
resource.load(new StringInputStream(model), null);
helper.validate(resource.getContents().get(0));
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class InferredJvmModelTest method test_No_Exception_bug395377.
@Test
public void test_No_Exception_bug395377() throws Exception {
String content = "@Data class Foo { String extension }";
XtextResourceSet set = getResourceSet();
String fileName = getFileName(content);
Resource resource = set.createResource(URI.createURI(fileName + ".xtend"));
resource.load(new StringInputStream(content), null);
XtendFile file = (XtendFile) resource.getContents().get(0);
getInferredType(file);
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class LinkingErrorTest method file.
@Override
protected XtendFile file(String string, boolean validate) throws Exception {
if (validate)
return super.file(string, validate);
XtextResourceSet set = getResourceSet();
String fileName = getFileName(string);
Resource resource = set.createResource(URI.createURI(fileName + ".xtend"));
resource.load(new StringInputStream(string), null);
XtendFile file = (XtendFile) resource.getContents().get(0);
return file;
}
Aggregations