UserRegion Does not work... Please help [message #43123] |
Fri, 14 March 2008 17:46 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02339 seconds