@Check public void checkGenerators(final MobaApplication application) { boolean activeFound = false; int firstIndex = (-1); List<MobaGenerator> _generators = application.getGenerators(); int _size = _generators.size(); boolean _greaterThan = (_size > 1); if (_greaterThan) { List<MobaGenerator> _generators_1 = application.getGenerators(); for (final MobaGenerator generator : _generators_1) { { if ((firstIndex == (-1))) { EList<MobaApplicationFeature> _features = application.getFeatures(); int _indexOf = _features.indexOf(generator); firstIndex = _indexOf; } boolean _and = false; if (!activeFound) { _and = false; } else { boolean _isActive = generator.isActive(); _and = _isActive; } if (_and) { EList<MobaApplicationFeature> _features_1 = application.getFeatures(); final int index = _features_1.indexOf(generator); StringConcatenation _builder = new StringConcatenation(); _builder.append( "You are using multiple generators. Please define the active attribute for ONLY one generator."); this.error( _builder.toString(), application, MobaPackage.Literals.MOBA_APPLICATION__FEATURES, index); return; } if ((!activeFound)) { boolean _isActive_1 = generator.isActive(); activeFound = _isActive_1; } } } if ((!activeFound)) { StringConcatenation _builder = new StringConcatenation(); _builder.append( "You are using multiple generators. Please define the #active attribute for one generator."); this.error( _builder.toString(), application, MobaPackage.Literals.MOBA_APPLICATION__FEATURES, firstIndex); } } }
@Check public void checkGeneratorIds(final MobaGenerator generator) { boolean foundWarning = false; int index = (-1); final EList<MobaGeneratorFeature> features = generator.getFeatures(); final Function1<MobaGeneratorFeature, Boolean> _function = (MobaGeneratorFeature it) -> { return Boolean.valueOf((it instanceof MobaGeneratorIDFeature)); }; Iterable<MobaGeneratorFeature> _filter = IterableExtensions.<MobaGeneratorFeature>filter(features, _function); final Function1<MobaGeneratorFeature, String> _function_1 = (MobaGeneratorFeature it) -> { return it.getGeneratorVersionedId(); }; Iterable<String> _map = IterableExtensions.<MobaGeneratorFeature, String>map(_filter, _function_1); List<String> _list = IterableExtensions.<String>toList(_map); final Map<String, ExtensionGeneratorDelegate.Metadata> generatorMap = this.generatorDelegate.readExtentionsMetadata(this.grammarName, _list); EList<MobaGeneratorFeature> _features = generator.getFeatures(); for (final MobaGeneratorFeature feature : _features) { { index++; if ((feature instanceof MobaGeneratorIDFeature)) { String _generatorVersionedId = ((MobaGeneratorIDFeature) feature).getGeneratorVersionedId(); boolean _containsKey = generatorMap.containsKey(_generatorVersionedId); boolean _not = (!_containsKey); if (_not) { foundWarning = true; StringConcatenation _builder = new StringConcatenation(); _builder.append("For GeneratorID "); String _generatorVersionedId_1 = ((MobaGeneratorIDFeature) feature).getGeneratorVersionedId(); _builder.append(_generatorVersionedId_1, ""); _builder.append(" is not Generator-Extensions registered. Please check template..."); this.warning( _builder.toString(), generator, MobaPackage.Literals.MOBA_GENERATOR__FEATURES, index); } } } } if ((!foundWarning)) { List<String> _allGeneratorVersionedIds = generator.getAllGeneratorVersionedIds(); final Map<String, ExtensionGeneratorDelegate.Metadata> allGeneratorMap = this.generatorDelegate.readExtentionsMetadata( this.grammarName, _allGeneratorVersionedIds); List<String> _allGeneratorVersionedIds_1 = generator.getAllGeneratorVersionedIds(); for (final String id : _allGeneratorVersionedIds_1) { { index++; boolean _containsKey = allGeneratorMap.containsKey(id); boolean _not = (!_containsKey); if (_not) { foundWarning = true; StringConcatenation _builder = new StringConcatenation(); _builder.append("A mixin uses the GeneratorID "); _builder.append(id, ""); _builder.append( " and there is no Generator-Extensions registered. Please check template..."); this.warning(_builder.toString(), generator, MobaPackage.Literals.MOBA_GENERATOR__NAME); } } } } }