Java 类org.eclipse.xtext.scoping.IScopeProvider 实例源码

项目:xtext-extras    文件:AbstractScopingFragment.java   
@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();
}
项目:xtext-core    文件:URINormalizationTest.java   
@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());
}
项目:n4js    文件:ErrorAwareLinkingService.java   
/**
 * 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);
    }
}
项目:n4js    文件:N4JSRuntimeModule.java   
/**
 * 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);
}
项目:xtext-core    文件:DefaultLinkingService.java   
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());
    }
}
项目:xtext-core    文件:DefaultLinkingService.java   
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);
    }
}
项目:xtext-core    文件:IgnoreCaseLinkingWithDifferentWildcardTest.java   
@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);
                }
            });
        }
    });
}
项目:xtext-core    文件:Bug281990Test.java   
@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());
}
项目:dsl-devkit    文件:ScopingFragment.java   
/** {@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();
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return PkmntcgoScopeProvider.class;
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:n4js    文件:AbstractTypesRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return TypesScopeProvider.class;
}
项目:n4js    文件:AbstractTypesRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:n4js    文件:AbstractRegularExpressionRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return RegularExpressionScopeProvider.class;
}
项目:n4js    文件:AbstractRegularExpressionRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:n4js    文件:JSDocContentAssistProcessor.java   
/**
 * Returns the scope provider which is injected here but is used by the computer which does not support DI.
 */
public IScopeProvider getScopeProvider() {
    return scopeProvider;
}
项目:n4js    文件:N4JSRuntimeModule.java   
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return N4JSScopeProvider.class;
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return MyDslScopeProvider.class;
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:bromium    文件:AbstractBromiumRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return BromiumScopeProvider.class;
}
项目:bromium    文件:AbstractBromiumRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:gw4e.project    文件:AbstractDSLPoliciesRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XImportSectionNamespaceScopeProvider.class);
}
项目:lcdsl    文件:AbstractLcDslRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return LcDslScopeProvider.class;
}
项目:lcdsl    文件:AbstractLcDslRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:Saturn    文件:KronusRuntimeModule.java   
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return KronusLocalScopeProvider.class;
}
项目:gemoc-studio    文件:AbstractDslRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return DslScopeProvider.class;
}
项目:gemoc-studio    文件:AbstractDslRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return RestauranteScopeProvider.class;
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:OCCI-Studio    文件:AbstractOCCIRuntimeModule.java   
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return OCCIScopeProvider.class;
}
项目:OCCI-Studio    文件:AbstractOCCIRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:xtext-extras    文件:AbstractPureXbaseRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XImportSectionNamespaceScopeProvider.class);
}
项目:xtext-extras    文件:AbstractXbaseRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XImportSectionNamespaceScopeProvider.class);
}
项目:xtext-extras    文件:AbstractXbaseWithAnnotationsRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XImportSectionNamespaceScopeProvider.class);
}
项目:xtext-extras    文件:DefaultXbaseRuntimeModule.java   
@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
    return IBatchScopeProvider.class;
}
项目:xtext-extras    文件:DefaultXbaseRuntimeModule.java   
@Override
public void configureLinkingIScopeProvider(com.google.inject.Binder binder) {
    binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(org.eclipse.xtext.linking.LinkingScopeProviderBinding.class)
            .to(org.eclipse.xtext.xbase.scoping.batch.IBatchScopeProvider.class);
}
项目:xtext-extras    文件:DefaultXbaseRuntimeModule.java   
@Override
public void configureSerializerIScopeProvider(com.google.inject.Binder binder) {
    binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(org.eclipse.xtext.serializer.tokens.SerializerScopeProviderBinding.class)
            .to(org.eclipse.xtext.xbase.serializer.SerializerScopeProvider.class);
}
项目:xtext-extras    文件:DefaultXbaseRuntimeModule.java   
@SuppressWarnings("deprecation")
public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
    binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class)
            .annotatedWith(Names.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
            .to(org.eclipse.xtext.xbase.scoping.XbaseImportedNamespaceScopeProvider.class);
}
项目:xtext-extras    文件:XbaseBatchScopeProvider.java   
public void setDelegate(IScopeProvider delegate) {
    this.delegate = delegate;
}
项目:xtext-extras    文件:XbaseBatchScopeProvider.java   
@Override
public IScopeProvider getDelegate() {
    return delegate;
}