Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] white lines into code and code move([Acceleo] white lines into code and code move)
[Acceleo] white lines into code and code move [message #661021] Tue, 22 March 2011 17:54 Go to next message
olafo987  is currently offline olafo987 Friend
Messages: 13
Registered: November 2010
Junior Member
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 09:08 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

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 09:08]

Report message to a moderator

Previous Topic:[JET] Update input xml dynamically in JET
Next Topic:[Acceleo] Using tuples
Goto Forum:
  


Current Time: Wed Apr 24 22:56:24 GMT 2024

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

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

Back to the top