Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » JvmModelInferrer and JvmModelGenerator: generating error-less elements
JvmModelInferrer and JvmModelGenerator: generating error-less elements [message #1145431] Sat, 19 October 2013 14:10 Go to next message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Hi,

Here is my problem.

I have a DSL that define one metamodel type that can be instantiated multiple time in a given model.

I defined in my JvmModelInferrer and infer method for this metamodel type.

I have a model where I declare several elements of this metamodel type, and one of those has errors, but the others are ok and do no refer at all to the element with errors.

Why the JvmModelGenerator does not generate the corresponding java code for the error-less elements?
Is it possible to do so?

Thanks
Re: JvmModelInferrer and JvmModelGenerator: generating error-less elements [message #1149513 is a reply to message #1145431] Tue, 22 October 2013 06:15 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
By default code generation is turned off in case of errors.
You can activate it by subclass BuilderParticipant and overriding
shouldGenerate(). You active (bind) the new subclass by adding the
following method to the <MyLanguage>UiModule class.

public Class<? extends IXtextBuilderParticipant>
bindIXtextBuilderParticipant() {
return MyBuilderParticipant.class;
}



Am 10/19/13 4:10 PM, schrieb Victor Noël:
> Hi,
>
> Here is my problem.
>
> I have a DSL that define one metamodel type that can be instantiated
> multiple time in a given model.
>
> I defined in my JvmModelInferrer and infer method for this metamodel type.
>
> I have a model where I declare several elements of this metamodel type,
> and one of those has errors, but the others are ok and do no refer at
> all to the element with errors.
>
> Why the JvmModelGenerator does not generate the corresponding java code
> for the error-less elements?
> Is it possible to do so?
>
> Thanks


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: JvmModelInferrer and JvmModelGenerator: generating error-less elements [message #1149627 is a reply to message #1149513] Tue, 22 October 2013 07:44 Go to previous messageGo to next message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Ok, cool, now I just have to find a way to disable generation for the elements with error, but I don't think that will be very hard, I can just hook up into JvmModelGenerator Smile

Thank you
Re: JvmModelInferrer and JvmModelGenerator: generating error-less elements [message #1156603 is a reply to message #1149627] Sat, 26 October 2013 17:46 Go to previous message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Hi,

So, I'm a bit stuck:

Given an element of my model, check that there are errors or not inside this element.

In org.eclipse.xtext.builder.BuilderParticipant.shouldGenerate(Resource, IBuildContext), the check of presence of errors is done at the file level: I would like to do the same but within one element Smile
Previous Topic:Proposals crash when within quotes
Next Topic:Iterating through Xtext model and making decisions for Code Gen
Goto Forum:
  


Current Time: Fri Apr 26 22:31:31 GMT 2024

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

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

Back to the top