String typeString = null;
CALFeatureName featureName = metadata.getFeatureName();
// add link to module
ModuleName moduleName = featureName.toModuleName();
MetaModule module = owner.getPerspective().getMetaModule(moduleName);
NavAddress moduleUrl = NavAddress.getAddress(module);
buffer.append(getLinkHtml(NavAddress.getAddress(module), moduleName.toSourceText()));
buffer.append(separator);
// add link to parent or vault
if (metadata instanceof FunctionMetadata) {
NavAddress vaultUrl = moduleUrl.withParameter(NavAddress.VAULT_PARAMETER, NavAddress.FUNCTION_VAULT_VALUE);
buffer.append(getLinkHtml(vaultUrl, NavigatorMessages.getString("NAV_FunctionVault_Location")));
typeString = NavigatorMessages.getString("NAV_Function_Location");
} else if (metadata instanceof TypeConstructorMetadata) {
NavAddress vaultUrl = moduleUrl.withParameter(NavAddress.VAULT_PARAMETER, NavAddress.TYPE_VAULT_VALUE);
buffer.append(getLinkHtml(vaultUrl, NavigatorMessages.getString("NAV_TypeVault_Location")));
typeString = NavigatorMessages.getString("NAV_Type_Location");
} else if (metadata instanceof TypeClassMetadata) {
NavAddress vaultUrl = moduleUrl.withParameter(NavAddress.VAULT_PARAMETER, NavAddress.CLASS_VAULT_VALUE);
buffer.append(getLinkHtml(vaultUrl, NavigatorMessages.getString("NAV_ClassVault_Location")));
typeString = NavigatorMessages.getString("NAV_Class_Location");
} else if (metadata instanceof ClassInstanceMetadata) {
NavAddress vaultUrl = moduleUrl.withParameter(NavAddress.VAULT_PARAMETER, NavAddress.INSTANCE_VAULT_VALUE);
buffer.append(getLinkHtml(vaultUrl, NavigatorMessages.getString("NAV_InstanceVault_Location")));
typeString = NavigatorMessages.getString("NAV_Instance_Location");
} else if (metadata instanceof InstanceMethodMetadata) {
CALFeatureName methodFeatureName = metadata.getFeatureName();
NavAddress parentUrl = NavAddress.getAddress(CALFeatureName.getClassInstanceFeatureName(
methodFeatureName.toInstanceIdentifier(), methodFeatureName.toModuleName()));
buffer.append(getLinkHtml(parentUrl, NavAddressHelper.getDisplayText(owner, parentUrl, ScopedEntityNamingPolicy.UNQUALIFIED)));
typeString = NavigatorMessages.getString("NAV_InstanceMethod_Location");
} else if (metadata instanceof ClassMethodMetadata) {
typeString = NavigatorMessages.getString("NAV_ClassMethod_Location");
// figure out the type class this method belongs to
TypeClass parentClass = null;
CALFeatureName methodFeatureName = ((ClassMethodMetadata) metadata).getFeatureName();
QualifiedName methodName = methodFeatureName.toQualifiedName();
int classCount = module.getTypeInfo().getNTypeClasses();
for (int i = 0; i < classCount; i++) {
TypeClass typeClass = module.getTypeInfo().getNthTypeClass(i);
int methodCount = typeClass.getNClassMethods();
for (int n = 0; n < methodCount; n++) {
if (typeClass.getNthClassMethod(n).getName().equals(methodName)) {
parentClass = typeClass;
break;
}
}
if (parentClass != null) {
break;
}
}
if (parentClass != null) {
NavAddress parentUrl = NavAddress.getAddress(parentClass);
buffer.append(getLinkHtml(parentUrl, NavAddressHelper.getDisplayText(owner, parentUrl, ScopedEntityNamingPolicy.UNQUALIFIED)));
} else {
buffer.append("<font color='red'>" + NavigatorMessages.getString("NAV_ClassNotFound_Location") + "</font>");
}
} else if (metadata instanceof DataConstructorMetadata) {
typeString = NavigatorMessages.getString("NAV_Constructor_Location");
// figure out the type constructor this data constructor is for
CALFeatureName dataConsFeatureName = ((DataConstructorMetadata) metadata).getFeatureName();
QualifiedName dataConsName = dataConsFeatureName.toQualifiedName();
TypeConstructor parentCons = null;
int typeConsCount = module.getTypeInfo().getNTypeConstructors();
for (int i = 0; i < typeConsCount; i++) {
TypeConstructor typeCons = module.getTypeInfo().getNthTypeConstructor(i);
int dataConsCount = typeCons.getNDataConstructors();
for (int n = 0; n < dataConsCount; n++) {
if (typeCons.getNthDataConstructor(n).getName().equals(dataConsName)) {
parentCons = typeCons;