[Acceleo] white lines into code and code move [message #661021] |
Tue, 22 March 2011 13:54  |
Eclipse User |
|
|
|
Hello
Again I need your help.
I have two situations that I repeated several times:
1 - Sometimes, when he made a call to an internal template recursively, in the generated code I have blank lines between lines of code:
/**
* the gtNodiscMotive getter.
* @return the gtNodiscMotive.
*/
public GtNodiscMotiveDTO getGtNodiscMotive() {
return this.gtNodiscMotive;
}
/**
* the gtNodiscMotive setter.
* @param p_gtNodiscMotive the gtNodiscMotive to set.
*/
public void setGtNodiscMotive(final GtNodiscMotiveDTO p_gtNodiscMotive) {
this.gtNodiscMotive = p_gtNodiscMotive;
}
2 - In other times what happens is that if I generate the code more than once, the code moves to the right:
/**
* *
* @return BigDecimal
*/
public BigDecimal bigDecimalPrueba() {
LOGGER.debug("bigDecimalPrueba() inicio. ");
final BigDecimal out;
// Start of user code for logic of PruebaGenerarHelper1 - bigDecimalPrueba org.eclipse.uml2.uml.internal.impl.DataTypeImpl@cd6c31 (name: BigDecimal, visibility: <unset>) (isLeaf: false, isAbstract: false)
//TODO implemented method bigDecimalPrueba()
out = BigDecimal.valueOf(16L);
//End of user code
LOGGER.debug("bigDecimalPrueba() fin. " + out);
return out;
}
I think it is for any issue of context of the template but I can not detect it.
you have an idea that I may be going on. Strategy that I can continue to generate properly formatted code?
In advance, thank you for your generous support.
|
|
|
Re: [Acceleo] white lines into code and code move [message #661112 is a reply to message #661021] |
Wed, 23 March 2011 05:08  |
Eclipse User |
|
|
|
Hi,
In order to help you with this, it would be way easier if I had a the template involved but since I already faced those two problems, here is what I think:
1- blank lines
If you write this :
['doSomething']
[callMyTemplate(myParameter)/]
['doSomethingElse']
And if your call to "callMyTemplate(...)" returns en empty string, a blank line will be generated. If you want to prevent this from happening, you can use an "if".
['doSomething']
[if (not iKnowSomeConditionThatWillNotGenerateAnything)]
[callMyTemplate(myParameter)/]
[/if]
['doSomethingElse']
That way, you will prevent the blank line from being generated.
2- code moving to the right
Is that code inside of a protected area ? Because we have a bug for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=331978
If its not in a protected area, I'll have to look at the template involved because I've never seen this.
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
[Updated on: Wed, 23 March 2011 05:08] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02627 seconds