use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.
the class GeneratorNodeExtensions method appendNewLine.
/**
* Appends a line separator node to the given parent.
*
* @return the given parent node
*/
public CompositeGeneratorNode appendNewLine(final CompositeGeneratorNode parent, final String lineSeparator) {
List<IGeneratorNode> _children = parent.getChildren();
NewLineNode _newLineNode = new NewLineNode(lineSeparator, false);
_children.add(_newLineNode);
return parent;
}
use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.
the class GeneratorNodeExtensions method append.
/**
* Creates a text node containing the toString() representation of the given object and
* appends it to the given parent node.
*
* @return the given parent node
*/
public CompositeGeneratorNode append(final CompositeGeneratorNode parent, final Object object) {
if ((object instanceof StringConcatenationClient)) {
this.appendTemplate(parent, ((StringConcatenationClient) object));
} else {
if ((object instanceof IGeneratorNode)) {
List<IGeneratorNode> _children = parent.getChildren();
_children.add(((IGeneratorNode) object));
} else {
if ((object != null)) {
List<IGeneratorNode> _children_1 = parent.getChildren();
String _string = object.toString();
TextNode _textNode = new TextNode(_string);
_children_1.add(_textNode);
}
}
}
return parent;
}
use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.
the class TemplateNode method append.
@Override
public void append(final Object object, final String indentation) {
int _length = indentation.length();
boolean _greaterThan = (_length > 0);
if (_greaterThan) {
final CompositeGeneratorNode before = this.currentParent;
try {
IndentNode _indentNode = new IndentNode(indentation, false, true);
this.currentParent = _indentNode;
List<IGeneratorNode> _children = before.getChildren();
_children.add(this.currentParent);
this.append(object);
} finally {
this.currentParent = before;
}
} else {
this.append(object);
}
}
Aggregations