Search in sources :

Example 1 with StandaloneSetup

use of org.eclipse.emf.mwe.utils.StandaloneSetup in project xtext-core by eclipse.

the class XtextGenerator method initialize.

public void initialize() {
    if ((this.injector == null)) {
        XtextGenerator.LOG.info("Initializing Xtext generator");
        new StandaloneSetup().addRegisterGeneratedEPackage("org.eclipse.xtext.common.types.TypesPackage");
        this.initializeEncoding();
        this.injector = this.createInjector();
        this.injector.injectMembers(this);
        CodeConfig _instance = this.injector.<CodeConfig>getInstance(CodeConfig.class);
        final Procedure1<CodeConfig> _function = (CodeConfig it) -> {
            it.initialize(this.injector);
        };
        ObjectExtensions.<CodeConfig>operator_doubleArrow(_instance, _function);
        this.projectConfig.initialize(this.injector);
        this.cleaner.initialize(this.injector);
        this.standaloneSetup.initialize(this.injector);
        for (final XtextGeneratorLanguage language : this.languageConfigs) {
            {
                final Injector languageInjector = this.createLanguageInjector(this.injector, language);
                language.initialize(languageInjector);
            }
        }
    }
}
Also used : XtextGeneratorLanguage(org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage) IXtextGeneratorLanguage(org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage) Injector(com.google.inject.Injector) XtextGeneratorStandaloneSetup(org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup) XtextStandaloneSetup(org.eclipse.xtext.XtextStandaloneSetup) StandaloneSetup(org.eclipse.emf.mwe.utils.StandaloneSetup) CodeConfig(org.eclipse.xtext.xtext.generator.CodeConfig)

Example 2 with StandaloneSetup

use of org.eclipse.emf.mwe.utils.StandaloneSetup in project xtext-core by eclipse.

the class XtextGeneratorStandaloneSetup method setup.

private void setup() {
    final StandaloneSetup delegate = new StandaloneSetup();
    delegate.setScanClassPath(this.scanClasspath);
    final Consumer<Pair<String, String>> _function = (Pair<String, String> mapping) -> {
        ProjectMapping _projectMapping = new ProjectMapping();
        final Procedure1<ProjectMapping> _function_1 = (ProjectMapping it) -> {
            it.setProjectName(mapping.getKey());
            it.setPath(mapping.getValue());
        };
        ProjectMapping _doubleArrow = ObjectExtensions.<ProjectMapping>operator_doubleArrow(_projectMapping, _function_1);
        delegate.addProjectMapping(_doubleArrow);
    };
    this.getProjectMappings().forEach(_function);
}
Also used : Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) StandaloneSetup(org.eclipse.emf.mwe.utils.StandaloneSetup) ProjectMapping(org.eclipse.emf.mwe.utils.ProjectMapping) Pair(org.eclipse.xtext.xbase.lib.Pair)

Example 3 with StandaloneSetup

use of org.eclipse.emf.mwe.utils.StandaloneSetup in project xtext-core by eclipse.

the class XtextGeneratorResourceSetInitializer method initialize.

public void initialize(final ResourceSet resourceSet, final List<String> referencedResources) {
    final StandaloneSetup delegate = new StandaloneSetup();
    delegate.setResourceSet(resourceSet);
    resourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
    final Consumer<String> _function = (String it) -> {
        this.loadResource(it, resourceSet);
    };
    referencedResources.forEach(_function);
    this.registerGenModels(resourceSet);
    this.registerEPackages(resourceSet);
}
Also used : StandaloneSetup(org.eclipse.emf.mwe.utils.StandaloneSetup)

Aggregations

StandaloneSetup (org.eclipse.emf.mwe.utils.StandaloneSetup)3 Injector (com.google.inject.Injector)1 ProjectMapping (org.eclipse.emf.mwe.utils.ProjectMapping)1 XtextStandaloneSetup (org.eclipse.xtext.XtextStandaloneSetup)1 Pair (org.eclipse.xtext.xbase.lib.Pair)1 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)1 CodeConfig (org.eclipse.xtext.xtext.generator.CodeConfig)1 IXtextGeneratorLanguage (org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage)1 XtextGeneratorLanguage (org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage)1 XtextGeneratorStandaloneSetup (org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup)1