Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » UserRegion Does not work... Please help
UserRegion Does not work... Please help [message #43123] Fri, 14 March 2008 17:46 Go to next message
Eclipse UserFriend
Originally posted by: confmb.capgroup.com

I sent a message a few days ago about issues I am having with UserRegion -
unfortunately nobody replied and I think it is because the message was
somewhat lost in the thread.

Therefore I am resending the post - please - please - please help -


Below I include my full template - in order to be more specific.
A few important remark:
- I do have multiple user region. Is this ok?
- The user region inside the constructor never works - the code is
overwritten everytime.
- The third user region almosr never works - code overwritten everytime.
But I think I saw it working before on occasions (not sure).
- The second user region works almost always. Except that it works in
reverse - that is if I leave the tag @generated_OtherConstructor alone
then it does not overwritte my code. If I chnage the tag to
@!generated_OtherConstructor - then it overwrite the code. This is the
opposite behavior from what is explained in the documentation. Pretty
wierd isn't it?
- I have the text string "generated" somewhere in the comments of the
class. Does it matter? Isn't the tool suppose to parse the text of the
class and only worry about what is inside the user region markup comments?
For me these markups are :
// BEGIN user region <OtherMethod>
and
// END user region <OtherMethod>
Are they ok? Is there a specific convention I should follow?
- About the unmodifiedMarker. Since I have multiple user regions in the
class then these markups have different names. Is this ok? If not how
could jet distinguish between regions?

I hope this is more specific and will help find out what is going on.
If you can solve this problem for me then I will certainly be very
grateful.
This issue is preventing us from using jet more within our company. We
need to have some generated code be customized by the users and not
overwritten later.

Thanks a lot in adavance.

Frederic

___________________________Beginning of template_________________________

<c:include template="templates/class/class.codegen.comment.jet"/>
package <c:get select="$currentClass/@namespace"/>;
<java:importsLocation package="$currentClass/@namespace"/>

/**
* Documentation for the class <c:get select="$currentClass/@name"/>:
*
* This class contains the business functionality method associated with
this class.
* The infrastructure functionality for this class is auto generated and
is implemented in the class '{@link <java:import><c:get
select="$currentClass/@namespace"/>._g.<c:get
select="$currentClass/@name"/>_g</java:import>}'.
* <c:if test="$currentClass/@comment">
* <c:get select="$currentClass/@comment"/>
* </c:if>
*
* You can change the code in the user region. To prevent your changes
from being overwritten the next time the code is regenerated - please
remove the @generated tag.
*/
<c:include template="templates/class/jpa/EntityType.annotation.java.jet "/>
<c:include
template="templates/class/jpa/TableMapping.annotation.java.jet "/>
public class <c:get select="$currentClass/@name"/> extends
<java:import><c:get select="$currentClass/@namespace"/>._g.<c:get
select="$currentClass/@name"/>_g</java:import> {
<c:if test="$currentClass/@object-serializable-UID">
<c:include template="templates/field/SerializableUID.java.jet"/>

</c:if>

/**
* This is the default constructor.
*/
public <c:get select="$currentClass/@name" />() {
super();
<c:userRegion>
// BEGIN user region <DefaultConstructor>
<c:initialCode unmodifiedMarker="@generated_DefaultConstructor">
// @generated_DefaultConstructor
// initial code here...
</c:initialCode>
// END user region <DefaultConstructor>
</c:userRegion>
}

<c:userRegion>
// BEGIN user region <OtherConstructor>
<c:initialCode unmodifiedMarker="@generated_OtherConstructor">
// @generated_OtherConstructor
// initial code here...
</c:initialCode>
// END user region <OtherConstructor>
</c:userRegion>

<c:userRegion>
// BEGIN user region <OtherMethod>
<c:initialCode unmodifiedMarker="@generated_OtherMethod">
// @generated_OtherMethod
// initial code here...
</c:initialCode>
// END user region <OtherMethod>
</c:userRegion>

}
___________________________End of template_________________________
Update: UserRegion Does not work... Please help [message #43186 is a reply to message #43123] Fri, 14 March 2008 18:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: confmb.capgroup.com

I downloaded the latest jet - version 9.0 from March 2008.
I am now able to make ONE user region work.

This is quite good indeed. But I am still wondering - is multiple user
region supported or not? Can someone tell me?
Because obviously if it is not then I should not spend time trying to make
it work. I just would like to know.

Thank you,

Frederic
Latest Update: UserRegion Does not work... Please help [message #43219 is a reply to message #43186] Fri, 14 March 2008 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: confmb.capgroup.com

Unbelievable!!! It works!

With the latest jet binary I can have multiple user regions and it works.

I am going to continue testing this - just to be sure - but this is
looking better :)

Hopefully I don't have to write another post on this thread. This would
mean the user region feature keeps working for me... All my fingers are
crossed right now ;) (and I am smilling too...)

I guess something got fixed between the latest version of jet and the one
I was using before.

Frederic
Re: Latest Update: UserRegion Does not work... Please help [message #43674 is a reply to message #43219] Wed, 26 March 2008 14:16 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Frederic:

As I said on another thread, there was an issue in 0.8.1, which is fixed in
0.8.2 and 0.9.0

Thanks for your patience and persistence.

Paul

"Frederic" <confmb@capgroup.com> wrote in message
news:cb67bf2e336c5b3d5986a8936b9e63fa$1@www.eclipse.org...
> Unbelievable!!! It works!
>
> With the latest jet binary I can have multiple user regions and it works.
>
> I am going to continue testing this - just to be sure - but this is
> looking better :)
>
> Hopefully I don't have to write another post on this thread. This would
> mean the user region feature keeps working for me... All my fingers are
> crossed right now ;) (and I am smilling too...)
>
> I guess something got fixed between the latest version of jet and the one
> I was using before.
>
> Frederic
>
Previous Topic:difference between 'transform' and 'deployedTransforms' extension points
Next Topic:c:set with xpath expression value
Goto Forum:
  


Current Time: Thu Apr 18 08:34:40 GMT 2024

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

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

Back to the top