DefUnit defUnit = tryCast(namedElement, DefUnit.class);
if(defUnit == null) {
return namedElement.getFullyQualifiedName();
}
ASTCodePrinter cp = new ASTCodePrinter();
switch (defUnit.getNodeType()) {
case DEFINITION_VARIABLE: {
DefinitionVariable var = (DefinitionVariable) defUnit;
return typeRefToUIString(var.type) + " " + var.getName();
}
case DEFINITION_VAR_FRAGMENT: {
DefVarFragment fragment = (DefVarFragment) defUnit;
return typeRefToUIString(fragment.getDeclaredType()) + " " + fragment.getName();
}
case DEFINITION_FUNCTION: {
DefinitionFunction function = (DefinitionFunction) defUnit;
cp.appendStrings(typeRefToUIString(function.retType), " ");
cp.append(function.getName());
cp.appendList("(", function.tplParams, ", ", ") ");
cp.appendList("(", function.getParams_asNodes(), ", ", ") ");
return cp.toString();
}
default: break;
}
if(defUnit instanceof DefinitionAggregate) {
DefinitionAggregate defAggr = (DefinitionAggregate) defUnit;
cp.append(defAggr.getName());
cp.appendList("(", defAggr.tplParams, ",", ") ");
return cp.toString();
}
// Default hover signature:
return defUnit.getName();
}