Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Use IDerivedStateComputer with non-xbase projects
Use IDerivedStateComputer with non-xbase projects [message #1031550] Mon, 01 April 2013 23:14 Go to next message
Boris Brodski is currently offline Boris BrodskiFriend
Messages: 112
Registered: July 2009
Senior Member
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 09:31 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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 #1031912 is a reply to message #1031853] Tue, 02 April 2013 11:13 Go to previous messageGo to next message
Boris Brodski is currently offline Boris BrodskiFriend
Messages: 112
Registered: July 2009
Senior Member
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
Re: Use IDerivedStateComputer with non-xbase projects [message #1033561 is a reply to message #1031912] Thu, 04 April 2013 11:17 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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 #1033635 is a reply to message #1033561] Thu, 04 April 2013 13:09 Go to previous messageGo to next message
Boris Brodski is currently offline Boris BrodskiFriend
Messages: 112
Registered: July 2009
Senior Member
Hello Sebastian,


thank you for the quick response!

Do you by "XtextGeneratorFragment" mean "XbaseGeneratorFragment"?
It binds DerivedStateAwareResourceDescriptionManager and XbaseResourceDescriptionStrategy. 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.

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
Re: Use IDerivedStateComputer with non-xbase projects [message #1033704 is a reply to message #1033635] Thu, 04 April 2013 14:41 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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
Re: Use IDerivedStateComputer with non-xbase projects [message #1033738 is a reply to message #1033704] Thu, 04 April 2013 15:26 Go to previous messageGo to next message
Boris Brodski is currently offline Boris BrodskiFriend
Messages: 112
Registered: July 2009
Senior Member
Hello Sebastian,


thank you very much!!!

I post here the link to the new screen cast soon, in case someone is curios.


Kind regards,
Boris
Re: Use IDerivedStateComputer with non-xbase projects [message #1036374 is a reply to message #1033738] Mon, 08 April 2013 09:47 Go to previous message
Boris Brodski is currently offline Boris BrodskiFriend
Messages: 112
Registered: July 2009
Senior Member
Hello,


the screen cast: http://xtextcasts.org/episodes/18-model-optimization


Kind regards,
Boris
Previous Topic:Using Xtext 2.3.1 Included Parser
Next Topic:Xtext 2.0.0 - Problem with custom DescriptionLabelProvider
Goto Forum:
  


Current Time: Tue Mar 19 09:32:58 GMT 2024

Powered by FUDForum. Page generated in 0.02819 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top