use of org.whole.lang.queries.model.EntityType in project whole by wholeplatform.
the class QueriesContentAssistVisitor method visit.
@Override
public void visit(Name entity) {
IEntity bindEntity = entity.wGetParent();
if (!Matcher.match(Bind, bindEntity))
return;
IEntity bindingsEntity = bindEntity.wGetParent();
if (!Matcher.match(Bindings, bindingsEntity))
return;
EntityType entityType;
boolean allLanguageFeatures;
IEntity entityCallOrTemplateEntity = bindingsEntity.wGetParent();
switch(entityCallOrTemplateEntity.wGetEntityDescriptor().getOrdinal()) {
case EntityCall_ord:
entityType = ((EntityCall) entityCallOrTemplateEntity).getName();
allLanguageFeatures = true;
break;
case EntityTemplate_ord:
entityType = ((EntityTemplate) entityCallOrTemplateEntity).getName();
allLanguageFeatures = false;
break;
default:
return;
}
if (!DataTypeUtils.getDataKind(entityType).isString())
return;
String edUri = entityType.wStringValue();
TreeSet<String> sortedNames = new TreeSet<String>();
EntityDescriptor<?> ed = CommonsDataTypePersistenceParser.getEntityDescriptor(edUri, false, null);
if (allLanguageFeatures || ed == null) {
ILanguageKit lk = CommonsDataTypePersistenceParser.getLanguageKitPart(edUri);
if (lk == null)
return;
Set<String> fNames = lk.getFeatureDescriptorEnum().names();
sortedNames.addAll(fNames);
} else
for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) sortedNames.add(fd.getName());
allFeatureNames(sortedNames, entity.getValue());
}
Aggregations