项目: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();
}
@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);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。