Search in sources :

Example 11 with IXtextGeneratorFileSystemAccess

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

the class XtextAntlrGeneratorFragment2 method generateProductionGrammar.

protected void generateProductionGrammar() {
    @Extension final GrammarNaming naming = this.productionNaming;
    final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getRuntime().getSrcGen();
    this.productionGenerator.generate(this.getGrammar(), this.getOptions(), fsa);
    this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
    this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
    this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
    this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
    this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
    this.normalizeLineDelimiters(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
}
Also used : Extension(org.eclipse.xtext.xbase.lib.Extension) ContentAssistGrammarNaming(org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming) GrammarNaming(org.eclipse.xtext.xtext.generator.parser.antlr.GrammarNaming) IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)

Example 12 with IXtextGeneratorFileSystemAccess

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

the class ContentAssistFragment2 method generate.

@Override
public void generate() {
    ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
    boolean _tripleNotEquals = (_manifest != null);
    if (_tripleNotEquals) {
        Set<String> _requiredBundles = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
        _requiredBundles.add("org.eclipse.xtext.ui");
    }
    GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
    TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.contentassist.IContentProposalProvider");
    _bindingFactory.addTypeToType(_typeReference, this.getProposalProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule());
    IXtextGeneratorFileSystemAccess _srcGen = this.getProjectConfig().getEclipsePlugin().getSrcGen();
    boolean _tripleNotEquals_1 = (_srcGen != null);
    if (_tripleNotEquals_1) {
        this.generateGenJavaProposalProvider();
    }
    if ((this.isGenerateStub() && (this.getProjectConfig().getEclipsePlugin().getSrc() != null))) {
        boolean _isGenerateXtendStub = this.isGenerateXtendStub();
        if (_isGenerateXtendStub) {
            this.generateXtendProposalProviderStub();
            ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest();
            boolean _tripleNotEquals_2 = (_manifest_1 != null);
            if (_tripleNotEquals_2) {
                Set<String> _requiredBundles_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
                String _xbaseLibVersionLowerBound = this.getProjectConfig().getRuntime().getXbaseLibVersionLowerBound();
                String _plus = ("org.eclipse.xtext.xbase.lib;bundle-version=\"" + _xbaseLibVersionLowerBound);
                String _plus_1 = (_plus + "\"");
                _requiredBundles_1.add(_plus_1);
                Set<String> _requiredBundles_2 = this.getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles();
                _requiredBundles_2.add("org.eclipse.xtend.lib;resolution:=optional");
            }
        } else {
            this.generateJavaProposalProviderStub();
        }
    }
    ManifestAccess _manifest_2 = this.getProjectConfig().getEclipsePlugin().getManifest();
    boolean _tripleNotEquals_3 = (_manifest_2 != null);
    if (_tripleNotEquals_3) {
        Set<String> _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
        String _packageName = this.getProposalProviderClass(this.getGrammar()).getPackageName();
        _exportedPackages.add(_packageName);
    }
}
Also used : GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) ManifestAccess(org.eclipse.xtext.xtext.generator.model.ManifestAccess) IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Aggregations

IXtextGeneratorFileSystemAccess (org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)12 ManifestAccess (org.eclipse.xtext.xtext.generator.model.ManifestAccess)5 GuiceModuleAccess (org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess)4 TypeReference (org.eclipse.xtext.xtext.generator.model.TypeReference)4 Extension (org.eclipse.xtext.xbase.lib.Extension)2 IBundleProjectConfig (org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig)2 ContentAssistGrammarNaming (org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming)2 File (java.io.File)1 DirectoryCleaner (org.eclipse.emf.mwe.utils.DirectoryCleaner)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)1 Grammar (org.eclipse.xtext.Grammar)1 IXtextGeneratorLanguage (org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage)1 XtextGeneratorLanguage (org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage)1 GeneratedJavaFileAccess (org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess)1 PluginXmlAccess (org.eclipse.xtext.xtext.generator.model.PluginXmlAccess)1 ISubProjectConfig (org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig)1 AntlrGrammar (org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar)1 CombinedGrammarMarker (org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker)1 GrammarNaming (org.eclipse.xtext.xtext.generator.parser.antlr.GrammarNaming)1