Use IDerivedStateComputer with non-xbase projects [message #1031550] |
Mon, 01 April 2013 19:14  |
Eclipse User |
|
|
|
Hello!
My question is, is it possible to use IDerivedStateComputer within a Xtext but non-Xbase project. My problem is, that I can't find 'bindIDerivedStateComputer()' method within my XxxRuntimeModule. It looks, like the method is only available for Xbase projects.
If no, is there some alternative hook for altering the model?
If yes, how I should bind my IDerivedStateComputer implementation?
Xtext 2.3.1
Thank you very much!
Kind regards,
Boris
|
|
|
Re: Use IDerivedStateComputer with non-xbase projects [message #1031853 is a reply to message #1031550] |
Tue, 02 April 2013 05:31   |
Eclipse User |
|
|
|
Hi Boris,
if you bind the DerivedStateAwareResource to the LazyLinkingResource,
you can simply add the respective binding for the IDerivedStateComputer,
too. The methods don't have to be defined in a super type, they are
found reflectively when the injector is created.
Please note that you'll have to bind the respective implementation for
the resource descriptions, too.
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 02.04.13 01:14, schrieb Boris Brodski:
> Hello!
>
> My question is, is it possible to use IDerivedStateComputer within a
> Xtext but non-Xbase project. My problem is, that I can't find
> 'bindIDerivedStateComputer()' method within my XxxRuntimeModule. It
> looks, like the method is only available for Xbase projects.
>
> If no, is there some alternative hook for altering the model?
> If yes, how I should bind my IDerivedStateComputer implementation?
>
> Xtext 2.3.1
>
>
> Thank you very much!
>
>
> Kind regards,
> Boris
|
|
|
|
Re: Use IDerivedStateComputer with non-xbase projects [message #1033561 is a reply to message #1031912] |
Thu, 04 April 2013 07:17   |
Eclipse User |
|
|
|
Am 02.04.13 13:13, schrieb Boris Brodski:
> Hello Sebastian.
>
>
> Thanks for the great hint! The absence of the
> bindIDerivedStateComputer() was the clue to me, that it's not going to
> be used, if I bind it.
>
> Currently I have this binds and it seams to work!
>
> public Class<? extends IDerivedStateComputer> bindIDerivedStateComputer() {
> return MyDerivedStateComputer.class;
> }
>
> @Override
> public Class<? extends XtextResource> bindXtextResource() {
> return DerivedStateAwareResource.class;
> }
>
>
> But you mentioned some "respective implementation for the resource
> descriptions" and I can't figure out, what exactly did you meant by
> this. (I plan to show all this in the upcoming screen cast, so I'm
> interested in a clean solution)
>
> Thank you!
>
>
> Kind regards,
> Boris
>
Hi Boris,
please have a look at the bindings that are contributed by the
XtextGeneratorFragment. It registeres the
DerivedStateAwareResourceDescriptionManager to ensure that the state is
obtained for the correct phase in the lifecycle of a resource during the
build.
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
|
|
Re: Use IDerivedStateComputer with non-xbase projects [message #1033704 is a reply to message #1033635] |
Thu, 04 April 2013 10:41   |
Eclipse User |
|
|
|
Hi Boris,
comments inline.
Am 04.04.13 15:09, schrieb Boris Brodski:
> Hello Sebastian,
>
>
> thank you for the quick response!
>
> Do you by "XtextGeneratorFragment" mean "XbaseGeneratorFragment"?
> It binds DerivedStateAwareResourceDescriptionManager and
> XbaseResourceDescriptionStrategy.
Correct, that was a typo.
No other class has
> "ResourceDescription" in their names. I think, I don't need to bind
> XbaseResourceDescriptionStrategy, since it's a part of Xbase and it only
> deals with the user data during resource description creation.
>
The bindings look right to me.
Regards,
Sebastian
> For now my bindings look like this:
>
> public Class<? extends IDerivedStateComputer> bindIDerivedStateComputer() {
> return MyDerivedStateComputer.class;
> }
>
> @Override
> public Class<? extends XtextResource> bindXtextResource() {
> return DerivedStateAwareResource.class;
> }
>
> public Class<? extends IResourceDescription.Manager>
> bindIResourceDescriptionManager() {
> return DerivedStateAwareResourceDescriptionManager.class;
> }
>
>
>
> Kind regards,
> Boris
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05256 seconds