Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » newLineifNotEmpty on Generator(How to avoid newLineifNotEmpty in
newLineifNotEmpty on Generator [message #966006] Wed, 31 October 2012 17:26 Go to next message
Cristiano De Faveri is currently offline Cristiano De FaveriFriend
Messages: 13
Registered: August 2012
Junior Member

I have this code on Generator.xtend

	def dispatch compile(hql.QualifiedName qualifiedName) '''
		«FOR e: qualifiedName.qualifiers SEPARATOR '.'»

When compiling for, a code to insert newline is written

 protected CharSequence _compile(final QualifiedName qualifiedName) {
    StringConcatenation _builder = new StringConcatenation();
      EList<QualifiedElement> _qualifiers = qualifiedName.getQualifiers();
      boolean _hasElements = false;
      for(final QualifiedElement e : _qualifiers) {
        if (!_hasElements) {
          _hasElements = true;
        } else {
          _builder.appendImmediate(".", "");
        CharSequence _compile = this.compile(e);
        _builder.append(_compile, "");
       _builder.newLineIfNotEmpty();  // ---> This should not be here
    return _builder;

This newLineifNotEmpty method is inserting a extra space on my string

Ex:if I have two elements on qualifiedName, like a.b, generator is writing a.<space>b

How do I guide xtend to not generate this newLineifNotEmpty call ?

thanks in advance
Re: newLineifNotEmpty on Generator [message #966017 is a reply to message #966006] Wed, 31 October 2012 17:36 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11965
Registered: July 2009
Senior Member
Hi what about:


Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Bringing Xtext (or parts of it) to the web
Next Topic:Xbase and changed package names ?
Goto Forum:

Current Time: Thu May 24 12:28:32 GMT 2018

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

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

Back to the top