use of org.eclipse.emf.codegen.ecore.genmodel.GenClassifier in project xtext-core by eclipse.
the class GenModelUtil2 method getGenClassifier.
public static GenClassifier getGenClassifier(final EClassifier cls, final ResourceSet resourceSet) {
final GenPackage genPackage = GenModelUtil2.getGenPackage(cls.getEPackage(), resourceSet);
EList<GenClassifier> _genClassifiers = genPackage.getGenClassifiers();
for (final GenClassifier genCls : _genClassifiers) {
String _name = cls.getName();
String _name_1 = genCls.getEcoreClassifier().getName();
boolean _equals = Objects.equal(_name, _name_1);
if (_equals) {
return genCls;
}
}
StringConcatenation _builder = new StringConcatenation();
_builder.append("No GenClassifier named \'");
String _name_2 = cls.getName();
_builder.append(_name_2);
_builder.append("\' found in GenModel ");
URI _uRI = genPackage.eResource().getURI();
_builder.append(_uRI);
throw new RuntimeException(_builder.toString());
}
use of org.eclipse.emf.codegen.ecore.genmodel.GenClassifier in project xtext-core by eclipse.
the class GenModelUtil2 method getTypeLiteral.
public static String getTypeLiteral(final EClassifier classifier, final ResourceSet resourceSet) {
final GenClassifier genClassifier = GenModelUtil2.getGenClassifier(classifier, resourceSet);
boolean _isLiteralsInterface = genClassifier.getGenPackage().isLiteralsInterface();
if (_isLiteralsInterface) {
String _classifierID = genClassifier.getClassifierID();
return ("Literals." + _classifierID);
} else {
String _classifierAccessorName = genClassifier.getClassifierAccessorName();
String _plus = ("eINSTANCE.get" + _classifierAccessorName);
return (_plus + "()");
}
}
use of org.eclipse.emf.codegen.ecore.genmodel.GenClassifier in project xtext-core by eclipse.
the class GenModelUtil2 method getGenFeature.
public static GenFeature getGenFeature(final EStructuralFeature feature, final ResourceSet resourceSet) {
GenClassifier _genClassifier = GenModelUtil2.getGenClassifier(feature.getEContainingClass(), resourceSet);
final GenClass genCls = ((GenClass) _genClassifier);
EList<GenFeature> _genFeatures = genCls.getGenFeatures();
for (final GenFeature genFeat : _genFeatures) {
String _name = feature.getName();
String _name_1 = genFeat.getEcoreFeature().getName();
boolean _equals = Objects.equal(_name, _name_1);
if (_equals) {
return genFeat;
}
}
StringConcatenation _builder = new StringConcatenation();
_builder.append("No GenFeature named \'");
String _name_2 = feature.getName();
_builder.append(_name_2);
_builder.append("\' found in GenClass \'");
_builder.append(genCls);
_builder.append("\' from GenModel");
URI _uRI = genCls.eResource().getURI();
_builder.append(_uRI);
throw new RuntimeException(_builder.toString());
}
Aggregations