Search in sources :

Example 1 with TextNode

use of org.eclipse.xtext.generator.trace.node.TextNode 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;
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) TextNode(org.eclipse.xtext.generator.trace.node.TextNode)

Aggregations

StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)1 IGeneratorNode (org.eclipse.xtext.generator.trace.node.IGeneratorNode)1 TextNode (org.eclipse.xtext.generator.trace.node.TextNode)1