本文整理汇总了Java中org.eclipse.xtext.scoping.IScopeProvider类的典型用法代码示例。如果您正苦于以下问题:Java IScopeProvider类的具体用法?Java IScopeProvider怎么用?Java IScopeProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IScopeProvider类属于org.eclipse.xtext.scoping包,在下文中一共展示了IScopeProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGuiceBindingsRt
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
@Override
public Set<Binding> getGuiceBindingsRt(Grammar grammar) {
BindFactory factory = new BindFactory();
if (!XbaseGeneratorFragment.doesUseXbase(grammar)) {
if(isGenerateStub) {
factory.addTypeToType(IScopeProvider.class.getName(), getScopeProviderName(grammar, getNaming()));
} else {
factory.addTypeToType(IScopeProvider.class.getName(), getLocalScopeProvider().getName());
}
factory.addConfiguredBinding(
IScopeProvider.class.getName() + "Delegate",
"binder.bind(" + IScopeProvider.class.getName() + ".class"
+ ").annotatedWith(com.google.inject.name.Names.named("
+ AbstractDeclarativeScopeProvider.class.getName() + ".NAMED_DELEGATE" + ")).to("
+ getLocalScopeProvider().getName() + ".class)");
factory.addTypeToType(IGlobalScopeProvider.class.getName(), getGlobalScopeProvider().getName());
}
factory.addConfiguredBinding(IgnoreCaseLinking.class.getSimpleName(), "binder.bindConstant().annotatedWith("
+ IgnoreCaseLinking.class.getName() + ".class).to(" + isIgnoreCase() + ")");
return factory.getBindings();
}
示例2: testGetElementByClasspathURIEObject
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
@Test public void testGetElementByClasspathURIEObject() throws Exception {
with(ImportUriTestLanguageStandaloneSetup.class);
Main main = (Main) getModel("import 'classpath:/org/eclipse/xtext/linking/05.importuritestlanguage'\n"
+ "type Bar extends Foo");
Type bar = main.getTypes().get(0);
Type foo = bar.getExtends();
assertNotNull(foo);
assertFalse(foo.eIsProxy());
// we don't put contextual classpath:/ uris into the index thus
// they are partially normalized
if (Platform.isRunning()) {
assertEquals("bundleresource", EcoreUtil.getURI(foo).scheme());
} else {
assertEquals("file", EcoreUtil.getURI(foo).scheme());
}
IScopeProvider scopeProvider = get(IScopeProvider.class);
IScope scope = scopeProvider.getScope(bar, ImportedURIPackage.Literals.TYPE__EXTENDS);
Iterable<IEObjectDescription> elements = scope.getElements(foo);
assertEquals(1, size(elements));
assertEquals(EcoreUtil2.getPlatformResourceOrNormalizedURI(foo), elements.iterator().next().getEObjectURI());
}
示例3: getScope
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
/**
* Override to get scope based on the context, otherwise we might get scope for main language, while context is from
* sub-language.
*/
@Override
protected IScope getScope(EObject context, EReference reference) {
IScopeProvider scopeProvider = N4LanguageUtils.getServiceForContext(context, IScopeProvider.class)
.orElse(super.getScopeProvider());
if (getScopeProvider() == null)
throw new IllegalStateException("scopeProvider must not be null.");
try {
registerImportedNamesAdapter(scopeProvider, context);
return scopeProvider.getScope(context, reference);
} finally {
unRegisterImportedNamesAdapter(scopeProvider);
}
}
示例4: configureIScopeProviderDelegate
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
/**
* Sets the scope provider to use as delegate for the local scope provider. This delegate is used to handle imported
* elements. The customization makes elements that name is equal to the resource name both referenceable by e.g
* my/pack/A/A as well as my/pack/A if the resource name is A. In this delegate later the import of the built in
* types should be made.
*/
public void configureIScopeProviderDelegate(Binder binder) {
binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class)
.annotatedWith(
com.google.inject.name.Names
.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
.to(N4JSImportedNamespaceAwareLocalScopeProvider.class);
}
示例5: unRegisterImportedNamesAdapter
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
protected void unRegisterImportedNamesAdapter(IScopeProvider scopeProvider) {
if (scopeProvider instanceof AbstractGlobalScopeDelegatingScopeProvider) {
AbstractGlobalScopeDelegatingScopeProvider provider = (AbstractGlobalScopeDelegatingScopeProvider) scopeProvider;
provider.setWrapper(null);
} else if (scopeProvider instanceof IDelegatingScopeProvider) {
IDelegatingScopeProvider delegatingScopeProvider = (IDelegatingScopeProvider) scopeProvider;
unRegisterImportedNamesAdapter(delegatingScopeProvider.getDelegate());
}
}
示例6: registerImportedNamesAdapter
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
protected void registerImportedNamesAdapter(IScopeProvider scopeProvider, EObject context) {
if (scopeProvider instanceof AbstractGlobalScopeDelegatingScopeProvider) {
AbstractGlobalScopeDelegatingScopeProvider provider = (AbstractGlobalScopeDelegatingScopeProvider) scopeProvider;
ImportedNamesAdapter adapter = getImportedNamesAdapter(context);
provider.setWrapper(adapter);
} else if (scopeProvider instanceof IDelegatingScopeProvider) {
IDelegatingScopeProvider delegatingScopeProvider = (IDelegatingScopeProvider) scopeProvider;
registerImportedNamesAdapter(delegatingScopeProvider.getDelegate(), context);
}
}
示例7: setUp
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
with(new IgnoreCaseNamespacesTestLanguageStandaloneSetup() {
@Override
public Injector createInjector() {
return Guice.createInjector(new IgnoreCaseNamespacesTestLanguageRuntimeModule() {
@Override
public void configureIScopeProviderDelegate(Binder binder) {
binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(OtherWildcardLocalScopeProvider.class);
}
});
}
});
}
示例8: setUp
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
XtextStandaloneSetup.doSetup();
with(new LazyLinkingTestLanguageRuntimeModule() {
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return org.eclipse.xtext.linking.lazy.Bug281990Test.RecursiveScopeProvider.class;
}
});
new LazyLinkingTestLanguageStandaloneSetup().register(getInjector());
}
示例9: getGuiceBindingsRt
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
final BindFactory bindFactory = new BindFactory();
final String prefix = GrammarUtil.getNamespace(grammar) + ".scoping." + GrammarUtil.getName(grammar);
bindFactory.addTypeToType(IScopeProvider.class.getName(), prefix + "ScopeProvider");
bindFactory.addTypeToType(IScopeNameProvider.class.getName(), prefix + "ScopeNameProvider");
bindFactory.addTypeToType(ILinkingService.class.getName(), "com.avaloq.tools.ddk.xtext.linking.LinkingService");
return bindFactory.getBindings();
}
示例10: bindIScopeProvider
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
public Class<? extends IScopeProvider> bindIScopeProvider() {
return PkmntcgoScopeProvider.class;
}
示例11: configureIScopeProviderDelegate
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
public void configureIScopeProviderDelegate(Binder binder) {
binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
示例12: bindIScopeProvider
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
public Class<? extends IScopeProvider> bindIScopeProvider() {
return TypesScopeProvider.class;
}
示例13: bindIScopeProvider
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
public Class<? extends IScopeProvider> bindIScopeProvider() {
return RegularExpressionScopeProvider.class;
}
示例14: getScopeProvider
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
/**
* Returns the scope provider which is injected here but is used by the computer which does not support DI.
*/
public IScopeProvider getScopeProvider() {
return scopeProvider;
}
示例15: bindIScopeProvider
import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return N4JSScopeProvider.class;
}