Skip to content

Commit

Permalink
Correctly handle model aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
pkourouklidis committed May 30, 2024
1 parent 96701fb commit 73ac903
Showing 1 changed file with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1776,20 +1776,6 @@ public EolModelElementType getModelElementType(String modelAndType, AbstractModu
typeName = modelAndType;
}

// for (ModelDeclaration modelDeclaration : modelDeclarations) {
// if (modelElementType.getModelName().isEmpty()
// || modelDeclaration.getNameExpression().getName().equals(modelElementType.getModelName())
// || modelDeclaration.getAliasNameExpressions().get(0).getName()
// .equals(modelElementType.getModelName())) {
// Metamodel metamodel = modelDeclaration.getMetamodel();
// if (metamodel != null) {
// MetaClass metaClass = metamodel.getMetaClass(modelElementType.getTypeName());
// modelElementType.setMetaClass(metaClass);
// return modelElementType;
// }
// }
// }

IModel model = context.repository.getModelByNameSafe(modelName);
if (model == null) {
return null;
Expand All @@ -1808,8 +1794,10 @@ public EolModelElementType getModelElementType(String modelAndType, AbstractModu
}

}

Metamodel metamodel = context.modelDeclarations.get(model.getName()).getMetamodel();
if (modelName == "") {
modelName = model.getName();
}
Metamodel metamodel = context.modelDeclarations.get(modelName).getMetamodel();
if (metamodel != null) {
EolModelElementType modelElementType = new EolModelElementType(modelAndType);
modelElementType.setMetaClass(metamodel.getMetaClass(typeName));
Expand Down

0 comments on commit 73ac903

Please sign in to comment.