@Before
public void setUp() throws Exception {
factory = new ClasspathTypeProviderFactory(getClass().getClassLoader(),null);
resourceSet = new ResourceSetImpl();
typeScope = new ClasspathBasedTypeScope(factory.createTypeProvider(resourceSet),new IQualifiednameConverter.DefaultImpl(),Predicates.<IEObjectDescription>alwaysTrue());
constructorScope = new ClasspathBasedConstructorScope(typeScope);
}
@Test public void testGetElementByInstance_01() {
JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor();
JvmGenericType type = TypesFactory.eINSTANCE.createJvmGenericType();
type.setPackageName("java.lang");
type.setSimpleName("Object");
constructor.setSimpleName("Object");
type.getMembers().add(constructor);
IEObjectDescription element = getConstructorScope().getSingleElement(constructor);
assertNotNull(element);
assertEquals(new IQualifiednameConverter.DefaultImpl().toQualifiedname("java.lang.Object"),element.getName());
assertEquals(new IQualifiednameConverter.DefaultImpl().toQualifiedname("java.lang.Object"),element.getQualifiedname());
}
public ImportednamespaceAwareLocalScopeProvider(IGlobalScopeProvider globalScopeProvider,IQualifiednameProvider qualifiednameProvider,ICaseInsensitivityHelper caseInsensitivityHelper) {
super(globalScopeProvider,caseInsensitivityHelper);
this.qualifiednameProvider = qualifiednameProvider;
this.qualifiednameConverter = qualifiednameConverter;
}
@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);
}
项目:xtext-core
文件:FQNPrefixMatcher.java
项目:bts
文件:AbstractJavaBasedContentProposalProvider.java
项目:gama
文件:GamlRuntimeModule.java
@Override
public void configure(final Binder binder) {
super.configure(binder);
staticInitialize();
// binder.bind(ExpressionDescriptionBuilder.class);
// binder.bind(IDocManager.class).to(GamlResourceDocumenter.class);
// binder.bind(GamlSyntacticConverter.class);
binder.bind(IDefaultResourceDescriptionStrategy.class).to(GamlResourceDescriptionStrategy.class);
binder.bind(IQualifiednameConverter.class).to(GamlNameConverter.class);
binder.bind(IResourceDescription.Manager.class).to(GamlResourceDescriptionManager.class);
// binder.bind(IoUtputConfigurationProvider.class).to(GamlOutputConfigurationProvider.class);
binder.bind(IResourceValidator.class).to(GamlResourceValidator.class);
binder.bind(ErrorToDiagnoticTranslator.class);
}
项目:n4js
文件:N4JSRuntimeModule.java
项目:xtext-extras
文件:DefaultXbaseRuntimeModule.java
@Before
public void setUp() throws Exception {
factory = new ClasspathTypeProviderFactory(getClass().getClassLoader(),Predicates.<IEObjectDescription>alwaysTrue());
}
public ReflectionTypeScope(ReflectionTypeProvider typeProvider,filter);
}
项目:xtext-core
文件:PartialLinkingTest.java
@Override
public void setUp() throws Exception {
super.setUp();
with(ReferenceGrammarTestLanguageStandalonesetup.class);
IQualifiednameConverter nameConverter = new IQualifiednameConverter.DefaultImpl();
IQualifiednameProvider nameProvider = new DefaultDeclarativeQualifiednameProvider();
ImportUriGlobalScopeProvider globalScopeProvider = new ImportUriGlobalScopeProvider();
globalScopeProvider.setImportResolver(new ImportUriResolver());
globalScopeProvider.setCache(IResourceScopeCache.NullImpl.INSTANCE);
final ResourceDescriptionsprovider provider = new ResourceDescriptionsprovider();
provider.setResourceDescriptions(new Provider<IResourceDescriptions>() {
@Override
public IResourceDescriptions get() {
return new IResourceDescriptions.NullImpl();
}
});
globalScopeProvider.setResourceDescriptionsprovider(provider);
globalScopeProvider.setLoadondemandDescriptions(new Provider<LoadondemandResourceDescriptions>() {
@Override
public LoadondemandResourceDescriptions get() {
return PartialLinkingTest.this.get(LoadondemandResourceDescriptions.class);
}
});
CaseInsensitivityHelper caseInsensitivityHelper = new CaseInsensitivityHelper();
globalScopeProvider.setCaseInsensitivityHelper(caseInsensitivityHelper);
scopeProvider = new ImportednamespaceAwareLocalScopeProvider(globalScopeProvider,caseInsensitivityHelper);
modelAsText =
"spielplatz 1 {\n" +
" kind( Bommel1 1)\n" +
" kind( Bommel2 2)\n" +
" kind( Bommel3 3)\n" +
" erwachsener( Bob 4)\n" +
" erwachsener( Joe 5)\n" +
" familie( Familienname Bob Joe Bommel2 )\n" +
"}";
resource = getResourceFromString(modelAsText);
assertTrue(resource.getErrors().toString(),resource.getErrors().isEmpty());
model = resource.getParseResult().getRootASTElement();
final Iterator<EObject> iter = model.eAllContents();
while (iter.hasNext() && context == null) {
final EObject candidate = iter.next();
final String className = candidate.eClass().getName();
if (className.endsWith("Familie"))
context = candidate;
}
reference = (EReference) context.eClass().getEStructuralFeature("kinder");
}
项目:xtext-core
文件:IdeCrossrefProposalProvider.java
项目:xtext-core
文件:IdeContentProposalProvider.java
protected IQualifiednameConverter getConverter() {
return converter;
}
项目:bts
文件:AbstractContentProposalProvider.java
项目:bts
文件:DefaultQuickfixProvider.java
项目:gama
文件:GamlProposalProvider.java
/**
* @param contentAssistContext
* @param ruleName
* @param qualifiednameConverter
*/
public GamlProposalCreator(final ContentAssistContext contentAssistContext,final String ruleName,final IQualifiednameConverter qualifiednameConverter) {
super(contentAssistContext,ruleName,qualifiednameConverter);
context = contentAssistContext;
}
public XtxtUMLReferenceProposalTypeScope(IJdtTypeProvider typeProvider,filter);
}
项目:sadlos2
文件:SadlRuntimeModule.java
项目:dsl-devkit
文件:FormatRuntimeModule.java
项目:dsl-devkit
文件:ExportRuntimeModule.java
项目:dsl-devkit
文件:Index.java
/**
* Creates a new query for a type,using a given domain mapper and name converter.
*
* @param mapper
* to use
* @param nameConverter
* to use
* @param type
* to look for
* @return a query object
*/
protected Query(final IDomain.Mapper mapper,final IQualifiednameConverter nameConverter,final EClass type) {
this.realQuery = ContainerQuery.newBuilder(mapper,type);
this.nameConverter = nameConverter;
}
项目:dsl-devkit
文件:Index.java
/**
* Creates a new wrapper for an IEObjectDescription,using the given name converter and query context object. The context object is used to resolve the
* EObject,if needed.
*
* @param context
* of the query that produced this result
* @param nameConverter
* to use
* @param internalDescription
* to wrap
*/
protected Entry(final EObject context,final IEObjectDescription internalDescription) {
this.context = context;
this.nameConverter = nameConverter;
this.delegate = internalDescription;
}
项目:dsl-devkit
文件:ValidRuntimeModule.java
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。