当前位置: 首页>>代码示例>>Java>>正文


Java IScopeProvider类代码示例

本文整理汇总了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();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:AbstractScopingFragment.java

示例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());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:URINormalizationTest.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:ErrorAwareLinkingService.java

示例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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:N4JSRuntimeModule.java

示例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());
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:10,代码来源:DefaultLinkingService.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:DefaultLinkingService.java

示例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);
				}
			});
		}
	});
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:IgnoreCaseLinkingWithDifferentWildcardTest.java

示例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());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:Bug281990Test.java

示例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();
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:13,代码来源:ScopingFragment.java

示例10: bindIScopeProvider

import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
public Class<? extends IScopeProvider> bindIScopeProvider() {
	return PkmntcgoScopeProvider.class;
}
 
开发者ID:rehne93,项目名称:pokemon-tcgo-deck-generator,代码行数:4,代码来源:AbstractPkmntcgoRuntimeModule.java

示例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);
}
 
开发者ID:rehne93,项目名称:pokemon-tcgo-deck-generator,代码行数:4,代码来源:AbstractPkmntcgoRuntimeModule.java

示例12: bindIScopeProvider

import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
public Class<? extends IScopeProvider> bindIScopeProvider() {
	return TypesScopeProvider.class;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:4,代码来源:AbstractTypesRuntimeModule.java

示例13: bindIScopeProvider

import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
public Class<? extends IScopeProvider> bindIScopeProvider() {
	return RegularExpressionScopeProvider.class;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:4,代码来源:AbstractRegularExpressionRuntimeModule.java

示例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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:7,代码来源:JSDocContentAssistProcessor.java

示例15: bindIScopeProvider

import org.eclipse.xtext.scoping.IScopeProvider; //导入依赖的package包/类
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
	return N4JSScopeProvider.class;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:5,代码来源:N4JSRuntimeModule.java


注:本文中的org.eclipse.xtext.scoping.IScopeProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。