use of com.avaloq.tools.ddk.xtext.scope.scope.NamingDefinition in project dsl-devkit by dsldevkit.
the class ScopeJavaValidator method checkNameFunctionExists.
/**
* Verifies that a matching default name function exists for scope expressions without explicit name functions.
*
* @param expr
* scope expression to check
*/
@Check
public void checkNameFunctionExists(final SimpleScopeExpression expr) {
if (expr.getNaming() != null && !expr.getNaming().getNames().isEmpty()) {
return;
}
ScopeDefinition def = EObjectUtil.eContainer(expr, ScopeDefinition.class);
ScopeModel model = EObjectUtil.eContainer(expr, ScopeModel.class);
if (def != null && model != null) {
EClass scopeType = getType(def);
NamingSection namingSection = model.getNaming();
if (namingSection != null) {
for (NamingDefinition naming : namingSection.getNamings()) {
if (naming.getType() != null && isLeftMostSuperType(naming.getType(), scopeType)) {
return;
}
}
}
error(NLS.bind(Messages.missingNameFunction, scopeType.getName()), ScopePackage.Literals.SIMPLE_SCOPE_EXPRESSION__EXPR);
}
}
Aggregations