Search in sources :

Example 1 with ValueTypeNameHelper

use of org.hibernate.eclipse.console.workbench.ValueTypeNameHelper in project jbosstools-hibernate by jbosstools.

the class OrmLabelMap method getParticularLabel.

public static String getParticularLabel(IProperty field, final ConsoleConfiguration cfg) {
    StringBuffer name = new StringBuffer();
    name.append(field.getName());
    // $NON-NLS-1$
    name.append(" :");
    String typeString = null;
    IValue v = field.getValue();
    IType type = UtilTypeExtract.getTypeUsingExecContext(v, cfg);
    if (type != null && type.getAssociatedEntityName() != null) {
        typeString = type.getAssociatedEntityName();
    } else {
        IValue fieldValue = field.getValue();
        if (fieldValue != null && fieldValue.isComponent()) {
            typeString = fieldValue.getComponentClassName();
        } else if (fieldValue != null && fieldValue.isSimpleValue()) {
            typeString = fieldValue.getTypeName();
        }
    }
    if (typeString != null) {
        typeString = correctTypeString(typeString);
        name.append(SPACE);
        name.append(typeString);
        return name.toString();
    }
    IValue value = field.getValue();
    String typeName = null;
    if (value != null) {
        typeName = (String) new ValueTypeNameHelper(false).getTypeName(value);
        if (typeName != null) {
            // $NON-NLS-1$
            return field.getName() + " : " + typeName;
        }
    }
    return field.getName();
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) ValueTypeNameHelper(org.hibernate.eclipse.console.workbench.ValueTypeNameHelper) IType(org.jboss.tools.hibernate.runtime.spi.IType)

Aggregations

ValueTypeNameHelper (org.hibernate.eclipse.console.workbench.ValueTypeNameHelper)1 IType (org.jboss.tools.hibernate.runtime.spi.IType)1 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)1