Search in sources :

Example 1 with IResourceSetProvider

use of org.eclipse.xtext.ui.resource.IResourceSetProvider in project xtext-eclipse by eclipse.

the class StratumBreakpointAdapterFactory method getClassNamePattern.

protected String getClassNamePattern(IResource res) {
    if (!(res instanceof IStorage))
        return null;
    URI uri = uriMapper.getUri((IStorage) res);
    IResourceServiceProvider provider = providerRegistry.getResourceServiceProvider(uri);
    if (provider == null)
        return null;
    IResourceSetProvider resourceSetProvider = provider.get(IResourceSetProvider.class);
    ResourceSet set = resourceSetProvider.get(res.getProject());
    Resource resource = set.getResource(uri, true);
    if (resource instanceof XtextResource) {
        return getClassNamePattern((XtextResource) resource);
    }
    return null;
}
Also used : IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) XtextResource(org.eclipse.xtext.resource.XtextResource) IResource(org.eclipse.core.resources.IResource) Resource(org.eclipse.emf.ecore.resource.Resource) XtextResource(org.eclipse.xtext.resource.XtextResource) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) IStorage(org.eclipse.core.resources.IStorage) URI(org.eclipse.emf.common.util.URI) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) IResourceSetProvider(org.eclipse.xtext.ui.resource.IResourceSetProvider)

Example 2 with IResourceSetProvider

use of org.eclipse.xtext.ui.resource.IResourceSetProvider in project n4js by eclipse.

the class AbstractN4JSContentAssistTest method getResourceSet.

private XtextResourceSet getResourceSet() {
    IResourceSetProvider resourceSetProvider = get(IResourceSetProvider.class);
    ResourceSet result = resourceSetProvider.get(getJSProject());
    return (XtextResourceSet) result;
}
Also used : XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) IResourceSetProvider(org.eclipse.xtext.ui.resource.IResourceSetProvider)

Aggregations

ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 IResourceSetProvider (org.eclipse.xtext.ui.resource.IResourceSetProvider)2 IResource (org.eclipse.core.resources.IResource)1 IStorage (org.eclipse.core.resources.IStorage)1 URI (org.eclipse.emf.common.util.URI)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 SourceRelativeURI (org.eclipse.xtext.generator.trace.SourceRelativeURI)1 IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1