org.eclipse.xtext.service.AbstractElementFinder Java Examples
The following examples show how to use
org.eclipse.xtext.service.AbstractElementFinder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GrammarAccessFragment2.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected StringConcatenationClient parserRuleClasses(final EnumRule it) { StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); String _gaRuleAccessorClassName = GrammarAccessFragment2.this._grammarAccessExtensions.gaRuleAccessorClassName(it); _builder.append(_gaRuleAccessorClassName); _builder.append(" extends "); _builder.append(AbstractElementFinder.AbstractEnumRuleElementFinder.class); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("private final "); _builder.append(EnumRule.class, "\t"); _builder.append(" rule = ("); _builder.append(EnumRule.class, "\t"); _builder.append(") "); _builder.append(GrammarUtil.class, "\t"); _builder.append(".findRuleForName(getGrammar(), \""); String _qualifiedName = GrammarAccessFragment2.this.getQualifiedName(it); _builder.append(_qualifiedName, "\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); { List<AbstractElement> _containedAbstractElements = GrammarUtil.containedAbstractElements(it); for(final AbstractElement e : _containedAbstractElements) { _builder.append("\t"); _builder.append("private final "); TypeReference _typeRef = TypeReference.typeRef(e.eClass(), GrammarAccessFragment2.this.getLanguage()); _builder.append(_typeRef, "\t"); _builder.append(" "); String _gaElementAccessorLocalVarName = GrammarAccessFragment2.this.gaElementAccessorLocalVarName(e); _builder.append(_gaElementAccessorLocalVarName, "\t"); _builder.append(" = "); StringConcatenationClient _loadElementStatement = GrammarAccessFragment2.this.loadElementStatement(e); _builder.append(_loadElementStatement, "\t"); _builder.append(";"); _builder.newLineIfNotEmpty(); } } _builder.append("\t"); _builder.newLine(); _builder.append("\t"); String _grammarFragmentToString = GrammarAccessFragment2.this._grammarAccessExtensions.grammarFragmentToString(it, "//"); _builder.append(_grammarFragmentToString, "\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public EnumRule getRule() { return rule; }"); _builder.newLine(); { List<AbstractElement> _containedAbstractElements_1 = GrammarUtil.containedAbstractElements(it); for(final AbstractElement e_1 : _containedAbstractElements_1) { _builder.append("\t"); _builder.newLine(); _builder.append("\t"); String _grammarFragmentToString_1 = GrammarAccessFragment2.this._grammarAccessExtensions.grammarFragmentToString(e_1, "//"); _builder.append(_grammarFragmentToString_1, "\t"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("public "); TypeReference _typeRef_1 = TypeReference.typeRef(e_1.eClass(), GrammarAccessFragment2.this.getLanguage()); _builder.append(_typeRef_1, "\t"); _builder.append(" "); String _gaElementAccessMethodName = GrammarAccessFragment2.this._grammarAccessExtensions.gaElementAccessMethodName(e_1); _builder.append(_gaElementAccessMethodName, "\t"); _builder.append("() { return "); String _gaElementAccessorLocalVarName_1 = GrammarAccessFragment2.this.gaElementAccessorLocalVarName(e_1); _builder.append(_gaElementAccessorLocalVarName_1, "\t"); _builder.append("; }"); _builder.newLineIfNotEmpty(); } } _builder.append("}"); _builder.newLine(); } }; return _client; }