use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class URIsInEcoreFilesXtendTest method setUp.
@Before
public void setUp() throws Exception {
resourceSet = new XtextResourceSet();
resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(false));
resourceSet.getLoadOptions().put(XMLResource.OPTION_URI_HANDLER, this);
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class AbstractXbaseContentAssistTest method getResourceSet.
protected final XtextResourceSet getResourceSet() {
XtextResourceSet resourceSet = get(XtextResourceSet.class);
IJvmTypeProvider.Factory typeProviderFactory = new JdtTypeProviderFactory(this);
typeProviderFactory.findOrCreateTypeProvider(resourceSet);
resourceSet.setClasspathURIContext(getJavaProject(resourceSet));
return resourceSet;
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class ActiveAnnotationsRuntimeTest method assertProcessing.
@Override
public void assertProcessing(final Pair<String, String> macroFile, final Pair<String, String> clientFile, final Procedure1<? super CompilationUnitImpl> expectations) {
try {
final XtextResourceSet resourceSet = this.compileMacroResourceSet(macroFile, clientFile);
final Resource singleResource = IterableExtensions.<Resource>head(resourceSet.getResources());
singleResource.load(CollectionLiterals.<Object, Object>emptyMap());
final IAcceptor<CompilationTestHelper.Result> _function = (CompilationTestHelper.Result it) -> {
it.getGeneratedCode();
final CompilationUnitImpl unit = this.compilationUnitProvider.get();
final XtendFile xtendFile = IterableExtensions.<XtendFile>head(Iterables.<XtendFile>filter(singleResource.getContents(), XtendFile.class));
unit.setXtendFile(xtendFile);
expectations.apply(unit);
};
this.compiler.compile(resourceSet, _function);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class ActiveAnnotationsRuntimeTest method assertIssues.
public void assertIssues(final Pair<String, String> macroFile, final Pair<String, String> clientFile, final Procedure1<? super List<Issue>> expectations) {
try {
final XtextResourceSet resourceSet = this.compileMacroResourceSet(macroFile, clientFile);
Resource _head = IterableExtensions.<Resource>head(resourceSet.getResources());
final XtextResource singleResource = ((XtextResource) _head);
boolean _isLoaded = singleResource.isLoaded();
boolean _not = (!_isLoaded);
if (_not) {
singleResource.load(resourceSet.getLoadOptions());
}
final IResourceValidator validator = singleResource.getResourceServiceProvider().getResourceValidator();
expectations.apply(validator.validate(singleResource, CheckMode.ALL, CancelIndicator.NullImpl));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.resource.XtextResourceSet in project xtext-xtend by eclipse.
the class AbstractXtendTestCase method getResourceSet.
protected XtextResourceSet getResourceSet() {
XtextResourceSet set = resourceSetProvider.get();
set.setClasspathURIContext(getClass().getClassLoader());
return set;
}
Aggregations