Java 类org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager 实例源码

项目:xtext-core    文件:DefaultResourceDescriptionManagerTest.java   
@Before
public void setUp() throws Exception {
    EObject copy = EcoreUtil.copy(EcorePackage.eINSTANCE);
    resource = new ResourceImpl();
    resource.getContents().add(copy);
    IQualifiedNameProvider nameProvider = new IQualifiedNameProvider.AbstractImpl() {
        @Override
        public QualifiedName getFullyQualifiedName(EObject obj) {
            if (obj instanceof ENamedElement)
                return QualifiedName.create(((ENamedElement) obj).getName());
            return null;
        }
    };
    DefaultResourceDescriptionStrategy descriptionStrategy = new DefaultResourceDescriptionStrategy();
    descriptionStrategy.setQualifiedNameProvider(nameProvider);
    resourceDescription = new DefaultResourceDescription(resource, descriptionStrategy) {
        @Override
        public Iterable<QualifiedName> getImportedNames() {
            return importedNames;
        }
    };
    manager = new DefaultResourceDescriptionManager();
    importedNames = Collections.emptySet();
}
项目:xtext-core    文件:ImportedNamespaceAwareLocalScopeProviderTest.java   
@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);
}