use of com.avaloq.tools.ddk.xtext.scope.scope.NamingSection in project dsl-devkit by dsldevkit.
the class ScopingGeneratorUtil method isCaseInsensitive.
/**
* Determine whether a certain scope expression is case sensitive or not.
*
* @param expr
* The scope expression.
* @return true, if the expression is case insensitive; false otherwise.
*/
public static boolean isCaseInsensitive(final NamedScopeExpression expr) {
Casing casing = null;
if (expr.isCaseDef()) {
casing = expr.getCasing();
} else {
NamingSection naming = EObjectUtil.eContainer(expr, ScopeModel.class).getNaming();
casing = naming != null ? naming.getCasing() : Casing.SENSITIVE;
}
return casing == Casing.INSENSITIVE;
}
use of com.avaloq.tools.ddk.xtext.scope.scope.NamingSection in project dsl-devkit by dsldevkit.
the class ScopeModelImpl method basicSetNaming.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetNaming(NamingSection newNaming, NotificationChain msgs) {
NamingSection oldNaming = naming;
naming = newNaming;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ScopePackage.SCOPE_MODEL__NAMING, oldNaming, newNaming);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.avaloq.tools.ddk.xtext.scope.scope.NamingSection 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