Search in sources :

Example 1 with VarType

use of org.whole.lang.commons.model.VarType in project whole by wholeplatform.

the class CommonsContentAssistVisitor method visit.

public void visit(VarType entity) {
    try {
        IEntity variableEntity = entity.wGetParent();
        IEntity variableEntityParent = variableEntity.wGetParent();
        Set<EntityDescriptor<?>> assignableSet = getAllAssignableTo(variableEntityParent.wGetEntityDescriptor(variableEntity));
        assignableSet.remove(entity.getValue());
        List<VarType> assignableEntities = new ArrayList<VarType>(assignableSet.size());
        for (EntityDescriptor<?> ed : assignableSet) assignableEntities.add(CommonsEntityFactory.instance.createVarType(ed));
        Collections.sort(assignableEntities, new Comparator<VarType>() {

            public int compare(VarType e1, VarType e2) {
                return CommonsDataTypePresentationParser.unparseEntityDescriptor(e1.getValue()).compareToIgnoreCase(CommonsDataTypePresentationParser.unparseEntityDescriptor(e2.getValue()));
            }
        });
        getOperation().setResult(assignableEntities.toArray(new IEntity[0]));
    } catch (Exception e) {
    // do nothing on error
    }
}
Also used : EntityDescriptor(org.whole.lang.reflect.EntityDescriptor) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) VarType(org.whole.lang.commons.model.VarType)

Aggregations

ArrayList (java.util.ArrayList)1 VarType (org.whole.lang.commons.model.VarType)1 IEntity (org.whole.lang.model.IEntity)1 EntityDescriptor (org.whole.lang.reflect.EntityDescriptor)1