org.eclipse.xtext.scoping.IScopeProvider Java Examples
The following examples show how to use
org.eclipse.xtext.scoping.IScopeProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractScopingFragment.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@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(); }
Example #2
Source File: URINormalizationTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@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()); }
Example #3
Source File: IDelegatingScopeProvider.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Set the given wrapper on the given {@link IScopeProvider} if the scope provider is either a * delegating scope provider or an {@link AbstractGlobalScopeDelegatingScopeProvider}. * * The wrapper may be <code>null</code> * * @since 2.14 */ static void setWrapper(IScopeProvider scopeProvider, IScopeWrapper wrapper) { if (scopeProvider instanceof AbstractGlobalScopeDelegatingScopeProvider) { AbstractGlobalScopeDelegatingScopeProvider provider = (AbstractGlobalScopeDelegatingScopeProvider) scopeProvider; provider.setWrapper(wrapper); } else if (scopeProvider instanceof IDelegatingScopeProvider) { IDelegatingScopeProvider delegatingScopeProvider = (IDelegatingScopeProvider) scopeProvider; delegatingScopeProvider.setWrapper(wrapper); } }
Example #4
Source File: ErrorAwareLinkingService.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * 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); } }
Example #5
Source File: N4JSRuntimeModule.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * 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); }
Example #6
Source File: CheckCfgRuntimeModule.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@Override public Class<? extends IScopeProvider> bindIScopeProvider() { return CheckCfgScopeProvider.class; }
Example #7
Source File: Bug291022TestLanguageRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IScopeProvider> bindIScopeProvider() { return ScopeProvider.class; }
Example #8
Source File: Bug287941TestLanguageRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IScopeProvider> bindIScopeProvider() { return ScopeProvider.class; }
Example #9
Source File: AbstractXtendRuntimeModule.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XImportSectionNamespaceScopeProvider.class); }
Example #10
Source File: DelegatingScopeProviderTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public IScopeProvider getDelegate() { return delegate; }
Example #11
Source File: AbstractSimpleBeeLangTestLanguageRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return SimpleBeeLangTestLanguageScopeProvider.class; }
Example #12
Source File: Bug443705Test.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IScopeProvider> bindIScopeProvider() { return org.eclipse.xtext.linking.lazy.Bug443705Test.RecursiveScopeProvider.class; }
Example #13
Source File: AbstractStatemachineRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return StatemachineScopeProvider.class; }
Example #14
Source File: AbstractContentAssistTestLanguageRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #15
Source File: AbstractRefactoringTestLanguage2RuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return RefactoringTestLanguage2ScopeProvider.class; }
Example #16
Source File: AbstractRefactoringTestLanguage2RuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #17
Source File: AbstractDomainmodelRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XImportSectionNamespaceScopeProvider.class); }
Example #18
Source File: AbstractJavaBasedContentProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public IScopeProvider getScopeProvider() { return scopeProvider; }
Example #19
Source File: AbstractBeeLangTestLanguageRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return BeeLangTestLanguageScopeProvider.class; }
Example #20
Source File: AbstractReferringTestLanguageRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return ReferringTestLanguageScopeProvider.class; }
Example #21
Source File: AbstractCodetemplatesRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #22
Source File: AbstractSimpleBeeLangTestLanguageRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #23
Source File: AbstractIgnoreCaseImportsTestLanguageRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(SimpleLocalScopeProvider.class); }
Example #24
Source File: AbstractOutlineTestLanguageRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return OutlineTestLanguageScopeProvider.class; }
Example #25
Source File: CheckRuntimeModule.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@Override public void configureIScopeProviderDelegate(final com.google.inject.Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XImportSectionNamespaceScopeProvider.class); }
Example #26
Source File: AbstractTestLanguageRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return TestLanguageScopeProvider.class; }
Example #27
Source File: AbstractXmlRuntimeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #28
Source File: SequencerTestLanguageRuntimeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IScopeProvider> bindIScopeProvider() { return SequencerTestScopeProvider.class; }
Example #29
Source File: AbstractMyDslRuntimeModule.java From M2Doc with Eclipse Public License 1.0 | 4 votes |
public void configureIScopeProviderDelegate(Binder binder) { binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class); }
Example #30
Source File: AbstractMyDslRuntimeModule.java From M2Doc with Eclipse Public License 1.0 | 4 votes |
public Class<? extends IScopeProvider> bindIScopeProvider() { return MyDslScopeProvider.class; }