Search in sources :

Example 1 with DefaultResourceServiceProvider

use of org.eclipse.xtext.resource.impl.DefaultResourceServiceProvider in project xtext-core by eclipse.

the class ImportedNamespaceAwareLocalScopeProviderTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    with(new IndexTestLanguageStandaloneSetup());
    globalScopeProvider = new ResourceSetGlobalScopeProvider();
    nameProvider = new DefaultDeclarativeQualifiedNameProvider();
    nameConverter = new IQualifiedNameConverter.DefaultImpl();
    final DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
    strategy.setQualifiedNameProvider(nameProvider);
    final DefaultResourceDescriptionManager resourceDescMnr = new DefaultResourceDescriptionManager() {

        @Override
        public IResourceDescription getResourceDescription(Resource resource) {
            DefaultResourceDescription resourceDescription = new DefaultResourceDescription(resource, strategy);
            return resourceDescription;
        }
    };
    final DefaultResourceServiceProvider provider = new DefaultResourceServiceProvider() {

        @Override
        public Manager getResourceDescriptionManager() {
            return resourceDescMnr;
        }
    };
    globalScopeProvider.setGlobalResourceDecriptionProvider(new GlobalResourceDescriptionProvider(new ResourceServiceProviderRegistryImpl() {

        @Override
        public IResourceServiceProvider getResourceServiceProvider(URI uri, String contentType) {
            return provider;
        }
    }));
    CaseInsensitivityHelper caseInsensitivityHelper = new CaseInsensitivityHelper();
    globalScopeProvider.setCaseInsensitivityHelper(caseInsensitivityHelper);
    scopeProvider = new ImportedNamespaceAwareLocalScopeProvider(globalScopeProvider, nameProvider, nameConverter, caseInsensitivityHelper);
}
Also used : DefaultResourceServiceProvider(org.eclipse.xtext.resource.impl.DefaultResourceServiceProvider) DefaultDeclarativeQualifiedNameProvider(org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider) DefaultResourceDescription(org.eclipse.xtext.resource.impl.DefaultResourceDescription) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) IQualifiedNameConverter(org.eclipse.xtext.naming.IQualifiedNameConverter) DefaultResourceDescriptionManager(org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager) IndexTestLanguageStandaloneSetup(org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup) URI(org.eclipse.emf.common.util.URI) DefaultResourceDescriptionStrategy(org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy) ResourceServiceProviderRegistryImpl(org.eclipse.xtext.resource.impl.ResourceServiceProviderRegistryImpl)

Aggregations

URI (org.eclipse.emf.common.util.URI)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 IndexTestLanguageStandaloneSetup (org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup)1 DefaultDeclarativeQualifiedNameProvider (org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider)1 IQualifiedNameConverter (org.eclipse.xtext.naming.IQualifiedNameConverter)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 DefaultResourceDescription (org.eclipse.xtext.resource.impl.DefaultResourceDescription)1 DefaultResourceDescriptionManager (org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager)1 DefaultResourceDescriptionStrategy (org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy)1 DefaultResourceServiceProvider (org.eclipse.xtext.resource.impl.DefaultResourceServiceProvider)1 ResourceServiceProviderRegistryImpl (org.eclipse.xtext.resource.impl.ResourceServiceProviderRegistryImpl)1