Search in sources :

Example 51 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class EMFGeneratorFragment2 method generate.

@Override
public void generate() {
    boolean _isEmpty = IterableExtensions.isEmpty(Iterables.<GeneratedMetamodel>filter(this.getGrammar().getMetamodelDeclarations(), GeneratedMetamodel.class));
    if (_isEmpty) {
        return;
    }
    try {
        final Grammar clonedGrammar = this.cloneGrammarIntoNewResourceSet(this.getGrammar());
        final ResourceSet workingResourceSet = clonedGrammar.eResource().getResourceSet();
        final Function1<GeneratedMetamodel, EPackage> _function = (GeneratedMetamodel it) -> {
            return it.getEPackage();
        };
        final List<EPackage> generatedPackages = IterableExtensions.<EPackage>toList(IterableExtensions.<GeneratedMetamodel, EPackage>map(Iterables.<GeneratedMetamodel>filter(clonedGrammar.getMetamodelDeclarations(), GeneratedMetamodel.class), _function));
        if ((this.genModel != null)) {
            this.registerUsedGenModel(workingResourceSet.getURIConverter(), clonedGrammar);
        }
        boolean _isEmpty_1 = generatedPackages.isEmpty();
        boolean _not = (!_isEmpty_1);
        if (_not) {
            final Map<String, EPackage> usedEPackages = this.findAllUsedEPackages(generatedPackages);
            final Map<String, EPackage> loadedEPackages = this.findEPackagesInGenPackages(usedEPackages.keySet(), workingResourceSet);
            final Map<EObject, EObject> eNamedElementMapping = this.createENamedElementMapping(usedEPackages, loadedEPackages);
            this.replaceReferencesInGeneratedPackages(generatedPackages, eNamedElementMapping);
            final Resource ePackageResource = this.createResourceForEPackages(clonedGrammar, generatedPackages, workingResourceSet);
            if ((!this.skipGenerate)) {
                StringConcatenation _builder = new StringConcatenation();
                _builder.append("Generating EMF model");
                {
                    if (this.generateEdit) {
                        {
                            if (this.generateEditor) {
                                _builder.append(", edit");
                            } else {
                                _builder.append(" and edit");
                            }
                        }
                    }
                }
                {
                    if (this.generateEditor) {
                        _builder.append(" and editor");
                    }
                }
                _builder.append(" code");
                EMFGeneratorFragment2.LOG.info(_builder);
                final GenModel genModel = this.getSaveAndReconcileGenModel(clonedGrammar, generatedPackages, workingResourceSet);
                genModel.reconcile();
                this.doGenerate(genModel);
                this.addProjectContributions(clonedGrammar, generatedPackages, workingResourceSet);
                if (this.bindEPackageAndEFactory) {
                    for (final EPackage pkg : generatedPackages) {
                        {
                            final GenPackage genPkg = GenModelUtil2.getGenPackage(pkg, genModel.eResource().getResourceSet());
                            GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
                            TypeReference _typeRef = TypeReference.typeRef(genPkg.getQualifiedPackageInterfaceName());
                            StringConcatenationClient _client = new StringConcatenationClient() {

                                @Override
                                protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                                    String _packageInterfaceName = genPkg.getPackageInterfaceName();
                                    _builder.append(_packageInterfaceName);
                                    _builder.append(".eINSTANCE");
                                }
                            };
                            GuiceModuleAccess.BindingFactory _addTypeToInstance = _bindingFactory.addTypeToInstance(_typeRef, _client);
                            TypeReference _typeRef_1 = TypeReference.typeRef(genPkg.getQualifiedFactoryInterfaceName());
                            StringConcatenationClient _client_1 = new StringConcatenationClient() {

                                @Override
                                protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                                    String _factoryInterfaceName = genPkg.getFactoryInterfaceName();
                                    _builder.append(_factoryInterfaceName);
                                    _builder.append(".eINSTANCE");
                                }
                            };
                            _addTypeToInstance.addTypeToInstance(_typeRef_1, _client_1).contributeTo(this.getLanguage().getRuntimeGenModule());
                        }
                    }
                }
            }
            this.saveResource(ePackageResource);
        }
        this.updateBuildProperties();
    } catch (final Throwable _t) {
        if (_t instanceof Exception) {
            final Exception e = (Exception) _t;
            EMFGeneratorFragment2.LOG.error("Failed to execute EMF generator", e);
        } else {
            throw Exceptions.sneakyThrow(_t);
        }
    }
}
Also used : GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) Resource(org.eclipse.emf.ecore.resource.Resource) XMLResource(org.eclipse.emf.ecore.xmi.XMLResource) Grammar(org.eclipse.xtext.Grammar) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) GenPackage(org.eclipse.emf.codegen.ecore.genmodel.GenPackage) EPackage(org.eclipse.emf.ecore.EPackage) GeneratedMetamodel(org.eclipse.xtext.GeneratedMetamodel) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) GenModel(org.eclipse.emf.codegen.ecore.genmodel.GenModel) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 52 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class Formatter2Fragment2 method doGenerateStubFile.

protected void doGenerateStubFile() {
    boolean _isGenerateStub = this.isGenerateStub();
    boolean _not = (!_isGenerateStub);
    if (_not) {
        return;
    }
    boolean _isGenerateXtendStub = this.isGenerateXtendStub();
    if (_isGenerateXtendStub) {
        final XtendFileAccess xtendFile = this.fileAccessFactory.createXtendFile(this.getFormatter2Stub(this.getGrammar()));
        xtendFile.setResourceSet(this.getLanguage().getResourceSet());
        final LinkedHashMultimap<EClass, EReference> type2ref = LinkedHashMultimap.<EClass, EReference>create();
        this.getLocallyAssignedContainmentReferences(this.getLanguage().getGrammar(), type2ref);
        final LinkedHashMultimap<EClass, EReference> inheritedTypes = LinkedHashMultimap.<EClass, EReference>create();
        this.getInheritedContainmentReferences(this.getLanguage().getGrammar(), inheritedTypes, CollectionLiterals.<Grammar>newHashSet());
        final Set<EClass> types = type2ref.keySet();
        StringConcatenationClient _client = new StringConcatenationClient() {

            @Override
            protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                _builder.append("class ");
                String _simpleName = Formatter2Fragment2.this.getFormatter2Stub(Formatter2Fragment2.this.getGrammar()).getSimpleName();
                _builder.append(_simpleName);
                _builder.append(" extends ");
                TypeReference _stubSuperClass = Formatter2Fragment2.this.getStubSuperClass();
                _builder.append(_stubSuperClass);
                _builder.append(" {");
                _builder.newLineIfNotEmpty();
                _builder.append("\t");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("@");
                _builder.append(Inject.class, "\t");
                _builder.append(" extension ");
                TypeReference _grammarAccess = Formatter2Fragment2.this._grammarAccessExtensions.getGrammarAccess(Formatter2Fragment2.this.getGrammar());
                _builder.append(_grammarAccess, "\t");
                _builder.newLineIfNotEmpty();
                {
                    Iterable<EClass> _take = IterableExtensions.<EClass>take(types, 2);
                    for (final EClass type : _take) {
                        _builder.newLine();
                        _builder.append("\t");
                        StringConcatenationClient _generateFormatMethod = Formatter2Fragment2.this.generateFormatMethod(type, type2ref.get(type), inheritedTypes.containsKey(type));
                        _builder.append(_generateFormatMethod, "\t");
                        _builder.newLineIfNotEmpty();
                    }
                }
                _builder.append("\t");
                _builder.newLine();
                _builder.append("\t");
                _builder.append("// TODO: implement for ");
                final Function1<EClass, String> _function = (EClass it) -> {
                    return it.getName();
                };
                String _join = IterableExtensions.join(IterableExtensions.<EClass, String>map(IterableExtensions.<EClass>drop(types, 2), _function), ", ");
                _builder.append(_join, "\t");
                _builder.newLineIfNotEmpty();
                _builder.append("}");
                _builder.newLine();
            }
        };
        xtendFile.setContent(_client);
        xtendFile.writeTo(this.getProjectConfig().getRuntime().getSrc());
    } else {
        String _name = this.getClass().getName();
        String _plus = (_name + " has been configured to generate a Java stub, but that\'s not yet supported. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=481563");
        Formatter2Fragment2.LOG.error(_plus);
    }
}
Also used : XtendFileAccess(org.eclipse.xtext.xtext.generator.model.XtendFileAccess) EClass(org.eclipse.emf.ecore.EClass) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) EReference(org.eclipse.emf.ecore.EReference)

Example 53 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class GeneratorFragment2 method contributeEclipsePluginGuiceBindings.

protected void contributeEclipsePluginGuiceBindings() {
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            TypeReference _typeRef = TypeReference.typeRef("org.eclipse.core.resources.ResourcesPlugin");
            _builder.append(_typeRef);
            _builder.append(".getWorkspace().getRoot()");
        }
    };
    final StringConcatenationClient expression = _client;
    StringConcatenationClient _client_1 = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("binder.bind(");
            TypeReference _typeRef = TypeReference.typeRef("org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer");
            _builder.append(_typeRef);
            _builder.append(".class)");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(".annotatedWith(");
            _builder.append(Names.class, "\t");
            _builder.append(".named(\"builderPreferenceInitializer\"))");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(".to(");
            TypeReference _typeReference = new TypeReference("org.eclipse.xtext.builder.preferences", "BuilderPreferenceAccess.Initializer");
            _builder.append(_typeReference, "\t");
            _builder.append(".class);");
            _builder.newLineIfNotEmpty();
        }
    };
    final StringConcatenationClient statement = _client_1;
    new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef("org.eclipse.xtext.builder.IXtextBuilderParticipant"), TypeReference.typeRef("org.eclipse.xtext.builder.BuilderParticipant")).addTypeToInstance(TypeReference.typeRef("org.eclipse.core.resources.IWorkspaceRoot"), expression).addConfiguredBinding("BuilderPreferenceStoreInitializer", statement).contributeTo(this.getLanguage().getEclipsePluginGenModule());
}
Also used : StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 54 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class GrammarAccessExtensions method gaFullAccessor.

/**
 * Returns the invocation of the element accessor method as fully qualified Java statement.
 * Example: return FowlerDslTestLanguageGrammarAccess.INSTANCE.prStatemachine().ele1AssignmentStates()
 */
public StringConcatenationClient gaFullAccessor(final AbstractElement ele) {
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            TypeReference _grammarAccess = GrammarAccessExtensions.this.getGrammarAccess(GrammarUtil.getGrammar(ele));
            _builder.append(_grammarAccess);
            _builder.append(".INSTANCE.");
            String _gaRuleElementAccessor = GrammarAccessExtensions.this.gaRuleElementAccessor(ele);
            _builder.append(_gaRuleElementAccessor);
        }
    };
    return _client;
}
Also used : StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Example 55 with TypeReference

use of org.eclipse.xtext.xtext.generator.model.TypeReference in project xtext-core by eclipse.

the class GrammarAccessFragment2 method doGenerateGrammarAccess.

protected void doGenerateGrammarAccess() {
    final GeneratedJavaFileAccess javaFile = this.fileAccessFactory.createGeneratedJavaFile(this._grammarAccessExtensions.getGrammarAccess(this.getGrammar()));
    List<IClassAnnotation> _annotations = javaFile.getAnnotations();
    SingletonClassAnnotation _singletonClassAnnotation = new SingletonClassAnnotation();
    _annotations.add(_singletonClassAnnotation);
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("public class ");
            String _simpleName = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(GrammarAccessFragment2.this.getLanguage().getGrammar()).getSimpleName();
            _builder.append(_simpleName);
            _builder.append(" extends ");
            _builder.append(AbstractElementFinder.AbstractGrammarElementFinder.class);
            _builder.append(" {");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.newLine();
            {
                Iterable<ParserRule> _filter = Iterables.<ParserRule>filter(GrammarAccessFragment2.this.getLanguage().getGrammar().getRules(), ParserRule.class);
                for (final ParserRule r : _filter) {
                    _builder.append("\t");
                    StringConcatenationClient _parserRuleClasses = GrammarAccessFragment2.this.parserRuleClasses(r);
                    _builder.append(_parserRuleClasses, "\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("\t");
            _builder.newLine();
            {
                Iterable<EnumRule> _filter_1 = Iterables.<EnumRule>filter(GrammarAccessFragment2.this.getLanguage().getGrammar().getRules(), EnumRule.class);
                for (final EnumRule r_1 : _filter_1) {
                    _builder.append("\t");
                    StringConcatenationClient _parserRuleClasses_1 = GrammarAccessFragment2.this.parserRuleClasses(r_1);
                    _builder.append(_parserRuleClasses_1, "\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("\t");
            _builder.newLine();
            {
                EList<AbstractRule> _rules = GrammarAccessFragment2.this.getLanguage().getGrammar().getRules();
                for (final AbstractRule r_2 : _rules) {
                    _builder.append("\t");
                    StringConcatenationClient _cache = GrammarAccessFragment2.this.cache(r_2);
                    _builder.append(_cache, "\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("\t");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("private final ");
            _builder.append(Grammar.class, "\t");
            _builder.append(" grammar;");
            _builder.newLineIfNotEmpty();
            {
                List<Grammar> _effectivelyUsedGrammars = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar());
                for (final Grammar g : _effectivelyUsedGrammars) {
                    _builder.append("\t");
                    _builder.newLine();
                    _builder.append("\t");
                    _builder.append("private final ");
                    TypeReference _grammarAccess = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g);
                    _builder.append(_grammarAccess, "\t");
                    _builder.append(" ");
                    String _gaGrammarAccessLocalVarName = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(g);
                    _builder.append(_gaGrammarAccessLocalVarName, "\t");
                    _builder.append(";");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.newLine();
            _builder.append("\t");
            _builder.append("@");
            _builder.append(Inject.class, "\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("public ");
            String _simpleName_1 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(GrammarAccessFragment2.this.getLanguage().getGrammar()).getSimpleName();
            _builder.append(_simpleName_1, "\t");
            _builder.append("(");
            _builder.append(GrammarProvider.class, "\t");
            _builder.append(" grammarProvider");
            {
                List<Grammar> _effectivelyUsedGrammars_1 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar());
                for (final Grammar g_1 : _effectivelyUsedGrammars_1) {
                    _builder.append(",");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("\t\t");
                    TypeReference _grammarAccess_1 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_1);
                    _builder.append(_grammarAccess_1, "\t\t\t");
                    _builder.append(" ");
                    String _gaGrammarAccessLocalVarName_1 = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(g_1);
                    _builder.append(_gaGrammarAccessLocalVarName_1, "\t\t\t");
                }
            }
            _builder.append(") {");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("this.grammar = internalFindGrammar(grammarProvider);");
            _builder.newLine();
            {
                List<Grammar> _effectivelyUsedGrammars_2 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar());
                for (final Grammar g_2 : _effectivelyUsedGrammars_2) {
                    _builder.append("\t\t");
                    _builder.append("this.");
                    String _gaGrammarAccessLocalVarName_2 = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(g_2);
                    _builder.append(_gaGrammarAccessLocalVarName_2, "\t\t");
                    _builder.append(" = ");
                    String _gaGrammarAccessLocalVarName_3 = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(g_2);
                    _builder.append(_gaGrammarAccessLocalVarName_3, "\t\t");
                    _builder.append(";");
                    _builder.newLineIfNotEmpty();
                }
            }
            {
                EList<AbstractRule> _rules_1 = GrammarAccessFragment2.this.getLanguage().getGrammar().getRules();
                for (final AbstractRule r_3 : _rules_1) {
                    _builder.append("\t\t");
                    StringConcatenationClient _initializer = GrammarAccessFragment2.this.initializer(r_3);
                    _builder.append(_initializer, "\t\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("\t");
            _builder.append("}");
            _builder.newLine();
            _builder.append("\t");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("protected ");
            _builder.append(Grammar.class, "\t");
            _builder.append(" internalFindGrammar(");
            _builder.append(GrammarProvider.class, "\t");
            _builder.append(" grammarProvider) {");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append(Grammar.class, "\t\t");
            _builder.append(" grammar = grammarProvider.getGrammar(this);");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("while (grammar != null) {");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("if (\"");
            String _name = GrammarAccessFragment2.this.getLanguage().getGrammar().getName();
            _builder.append(_name, "\t\t\t");
            _builder.append("\".equals(grammar.getName())) {");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t\t\t");
            _builder.append("return grammar;");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("}");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append(List.class, "\t\t\t");
            _builder.append("<");
            _builder.append(Grammar.class, "\t\t\t");
            _builder.append("> grammars = grammar.getUsedGrammars();");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t\t");
            _builder.append("if (!grammars.isEmpty()) {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("grammar = grammars.iterator().next();");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("} else {");
            _builder.newLine();
            _builder.append("\t\t\t\t");
            _builder.append("return null;");
            _builder.newLine();
            _builder.append("\t\t\t");
            _builder.append("}");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("}");
            _builder.newLine();
            _builder.append("\t\t");
            _builder.append("return grammar;");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("}");
            _builder.newLine();
            _builder.append("\t");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("@Override");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("public ");
            _builder.append(Grammar.class, "\t");
            _builder.append(" getGrammar() {");
            _builder.newLineIfNotEmpty();
            _builder.append("\t\t");
            _builder.append("return grammar;");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("}");
            _builder.newLine();
            _builder.append("\t");
            _builder.newLine();
            {
                List<Grammar> _effectivelyUsedGrammars_3 = GrammarAccessFragment2.this.getEffectivelyUsedGrammars(GrammarAccessFragment2.this.getLanguage().getGrammar());
                for (final Grammar g_3 : _effectivelyUsedGrammars_3) {
                    _builder.append("\t");
                    _builder.newLine();
                    _builder.append("\t");
                    _builder.append("public ");
                    TypeReference _grammarAccess_2 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_3);
                    _builder.append(_grammarAccess_2, "\t");
                    _builder.append(" get");
                    String _simpleName_2 = GrammarAccessFragment2.this._grammarAccessExtensions.getGrammarAccess(g_3).getSimpleName();
                    _builder.append(_simpleName_2, "\t");
                    _builder.append("() {");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("\t");
                    _builder.append("return ");
                    String _gaGrammarAccessLocalVarName_4 = GrammarAccessFragment2.this.gaGrammarAccessLocalVarName(g_3);
                    _builder.append(_gaGrammarAccessLocalVarName_4, "\t\t");
                    _builder.append(";");
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("}");
                    _builder.newLine();
                }
            }
            _builder.newLine();
            {
                List<AbstractRule> _allRules = GrammarUtil.allRules(GrammarAccessFragment2.this.getLanguage().getGrammar());
                for (final AbstractRule r_4 : _allRules) {
                    _builder.append("\t");
                    _builder.newLine();
                    _builder.append("\t");
                    StringConcatenationClient _ter = GrammarAccessFragment2.this.getter(r_4, GrammarAccessFragment2.this.getLanguage().getGrammar());
                    _builder.append(_ter, "\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("}");
            _builder.newLine();
        }
    };
    javaFile.setContent(_client);
    javaFile.writeTo(this.getProjectConfig().getRuntime().getSrcGen());
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) SingletonClassAnnotation(org.eclipse.xtext.xtext.generator.model.annotations.SingletonClassAnnotation) Grammar(org.eclipse.xtext.Grammar) EnumRule(org.eclipse.xtext.EnumRule) EList(org.eclipse.emf.common.util.EList) AbstractElementFinder(org.eclipse.xtext.service.AbstractElementFinder) IClassAnnotation(org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation) GeneratedJavaFileAccess(org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess) List(java.util.List) EList(org.eclipse.emf.common.util.EList) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference) AbstractRule(org.eclipse.xtext.AbstractRule)

Aggregations

TypeReference (org.eclipse.xtext.xtext.generator.model.TypeReference)154 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)119 GuiceModuleAccess (org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess)27 GeneratedJavaFileAccess (org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess)24 Grammar (org.eclipse.xtext.Grammar)23 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)21 ManifestAccess (org.eclipse.xtext.xtext.generator.model.ManifestAccess)17 List (java.util.List)14 Set (java.util.Set)12 Test (org.junit.Test)12 JavaFileAccess (org.eclipse.xtext.xtext.generator.model.JavaFileAccess)11 PluginXmlAccess (org.eclipse.xtext.xtext.generator.model.PluginXmlAccess)11 IClassAnnotation (org.eclipse.xtext.xtext.generator.model.annotations.IClassAnnotation)10 AbstractRule (org.eclipse.xtext.AbstractRule)9 SuppressWarningsAnnotation (org.eclipse.xtext.xtext.generator.model.annotations.SuppressWarningsAnnotation)8 IBundleProjectConfig (org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig)8 ContentAssistGrammarNaming (org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming)7 EObject (org.eclipse.emf.ecore.EObject)6 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)6 ArrayList (java.util.ArrayList)5