Search in sources :

Example 1 with BasicMonitor

use of org.eclipse.emf.common.util.BasicMonitor in project xtext-core by eclipse.

the class EMFGeneratorFragment2 method doGenerate.

protected void doGenerate(final GenModel genModel) {
    final Generator generator = new Generator() {

        @Override
        public JControlModel getJControlModel() {
            if ((this.jControlModel == null)) {
                JControlModel _jControlModel = new JControlModel();
                this.jControlModel = _jControlModel;
                this.jControlModel.initialize(null, this.options.mergeRulesURI);
            }
            return this.jControlModel;
        }
    };
    GeneratorAdapterFactory.Descriptor.Registry _adapterFactoryDescriptorRegistry = generator.getAdapterFactoryDescriptorRegistry();
    String _lineDelimiter = this.codeConfig.getLineDelimiter();
    CvsIdFilteringGeneratorAdapterFactoryDescriptor _cvsIdFilteringGeneratorAdapterFactoryDescriptor = new CvsIdFilteringGeneratorAdapterFactoryDescriptor(_lineDelimiter);
    _adapterFactoryDescriptorRegistry.addDescriptor(GenModelPackage.eNS_URI, _cvsIdFilteringGeneratorAdapterFactoryDescriptor);
    genModel.setCanGenerate(true);
    generator.setInput(genModel);
    BasicMonitor _basicMonitor = new BasicMonitor();
    final Diagnostic diagnostic = generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, _basicMonitor);
    int _severity = diagnostic.getSeverity();
    boolean _notEquals = (_severity != Diagnostic.OK);
    if (_notEquals) {
        EMFGeneratorFragment2.LOG.warn(diagnostic);
    }
    if (this.generateEdit) {
        BasicMonitor _basicMonitor_1 = new BasicMonitor();
        final Diagnostic editDiag = generator.generate(genModel, GenBaseGeneratorAdapter.EDIT_PROJECT_TYPE, _basicMonitor_1);
        int _severity_1 = editDiag.getSeverity();
        boolean _notEquals_1 = (_severity_1 != Diagnostic.OK);
        if (_notEquals_1) {
            EMFGeneratorFragment2.LOG.warn(editDiag);
        }
    }
    if (this.generateEditor) {
        BasicMonitor _basicMonitor_2 = new BasicMonitor();
        final Diagnostic editorDiag = generator.generate(genModel, GenBaseGeneratorAdapter.EDITOR_PROJECT_TYPE, _basicMonitor_2);
        int _severity_2 = editorDiag.getSeverity();
        boolean _notEquals_2 = (_severity_2 != Diagnostic.OK);
        if (_notEquals_2) {
            EMFGeneratorFragment2.LOG.warn(editorDiag);
        }
    }
}
Also used : JControlModel(org.eclipse.emf.codegen.merge.java.JControlModel) CvsIdFilteringGeneratorAdapterFactoryDescriptor(org.eclipse.emf.mwe2.ecore.CvsIdFilteringGeneratorAdapterFactoryDescriptor) Diagnostic(org.eclipse.emf.common.util.Diagnostic) BasicMonitor(org.eclipse.emf.common.util.BasicMonitor) Generator(org.eclipse.emf.codegen.ecore.generator.Generator) CvsIdFilteringGeneratorAdapterFactoryDescriptor(org.eclipse.emf.mwe2.ecore.CvsIdFilteringGeneratorAdapterFactoryDescriptor)

Aggregations

Generator (org.eclipse.emf.codegen.ecore.generator.Generator)1 JControlModel (org.eclipse.emf.codegen.merge.java.JControlModel)1 BasicMonitor (org.eclipse.emf.common.util.BasicMonitor)1 Diagnostic (org.eclipse.emf.common.util.Diagnostic)1 CvsIdFilteringGeneratorAdapterFactoryDescriptor (org.eclipse.emf.mwe2.ecore.CvsIdFilteringGeneratorAdapterFactoryDescriptor)1