|
Re: [XBase] XBaseScopeProvider and declarative scoping [message #695465 is a reply to message #695291] |
Mon, 11 July 2011 20:07 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
Am 7/11/11 2:39 PM, schrieb Markus Schindler:
> Hello,
>
> I use the XBaseScopeProvider from the examples project.
> Is it possible to integrate declarative Scope Methods like IScope
> scope_[EClassName]_[EReferenceName](MyType context, EReference ref) from
> AbstractDeclarativeScopeProvider. Or, how can both IScopeProviders
> co-exists?
The AbstractDeclaratziveScopeProvider is provided with a delegate socpe
provider, which could be the XbaseScopeProvider.
public void configureIScopeProviderDelegate(com.google.inject.Binder
binder) {
binder.bind(IScopeProvider.class)
.annotatedWith(Names
.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
.to(XbaseScoepProvider.class);
}
>
> One question further, is it possible to get a JvmType from a String. For
> example: createJvmTypeFromString("com.foo.BarClass")
org.eclipse.xtext.common.types.util.TypeReferences.getTypeForName(String, Notifier,
JvmTypeReference...)
To use it let TypeReferences be injected into your class.
The notifier needs to be any EObject, Resource or ResourceSet being
(contained in) a correctly configured ResourceSet.
Sven
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Re: [XBase] XBaseScopeProvider and declarative scoping [message #696092 is a reply to message #695465] |
Wed, 13 July 2011 08:39 |
Markus Schindler Messages: 30 Registered: July 2009 |
Member |
|
|
Hello Sven,
Thanks, for your answer, but now I got a stack overflow, because the MyScopeProvider (extends AbstractDeclarativeScopeProvider) has a delegate to the
MyXBaseScopeProvider (extends XBaseScopeProvider) and this gets a delegate to itself.
This happens because both classes has a "@Inject @Named(NAMED_DELEGATE) private IScopeProvider delegate;" in there superclasses, so the
XBaseScopeProvider gets a delegate to itself via this injection.
How should I handle this?
Regards,
Markus
Am 11.07.2011 22:07, schrieb Sven Efftinge:
> Am 7/11/11 2:39 PM, schrieb Markus Schindler:
>> Hello,
>>
>> I use the XBaseScopeProvider from the examples project.
>> Is it possible to integrate declarative Scope Methods like IScope
>> scope_[EClassName]_[EReferenceName](MyType context, EReference ref) from
>> AbstractDeclarativeScopeProvider. Or, how can both IScopeProviders
>> co-exists?
>
> The AbstractDeclaratziveScopeProvider is provided with a delegate socpe
> provider, which could be the XbaseScopeProvider.
>
> public void configureIScopeProviderDelegate(com.google.inject.Binder
> binder) {
> binder.bind(IScopeProvider.class)
> .annotatedWith(Names
> .named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
> .to(XbaseScoepProvider.class);
> }
>
>
>>
>> One question further, is it possible to get a JvmType from a String. For
>> example: createJvmTypeFromString("com.foo.BarClass")
>
> org.eclipse.xtext.common.types.util.TypeReferences.getTypeForName(String, Notifier,
> JvmTypeReference...)
>
> To use it let TypeReferences be injected into your class.
> The notifier needs to be any EObject, Resource or ResourceSet being
> (contained in) a correctly configured ResourceSet.
>
> Sven
>
>
|
|
|
|
|
|
|
Re: [XBase] XBaseScopeProvider and declarative scoping [message #1059556 is a reply to message #699521] |
Mon, 20 May 2013 12:49 |
|
@Victor Mising name:
Thanks for documenting your solution to this. I just updated my Xtext DSL grammar to extend Xbase, which resulted in confusing scoping functionality.
It's been a few years since your post, but I thought I'd bump it to let people know that the issue you ran into still exists (Xtext 2.3.1) and your solution still works!
|
|
|
|
Powered by
FUDForum. Page generated in 0.03546 seconds