}
@Override
protected String getText(Object element, Object parentElement) {
if (element instanceof IBeanMetadata) {
IBeanMetadataLabelProvider labelProvider = BeanMetadataUtils.getLabelProvider((IBeanMetadata) element);
if (labelProvider != null) {
return labelProvider.getText(element);
}
}
if (element instanceof BeanMetadataNode) {
return ((BeanMetadataNode) element).getLabel();
}
else if (element instanceof ISourceModelElement) {
INamespaceLabelProvider provider = NamespaceUtils.getLabelProvider((ISourceModelElement) element);
IModelElement context = (parentElement instanceof IModelElement ? (IModelElement) parentElement : null);
if (provider != null) {
return provider.getText((ISourceModelElement) element, context, isDecorating());
}
else {
return DEFAULT_NAMESPACE_LABEL_PROVIDER.getText((ISourceModelElement) element, context, isDecorating());
}
}
else if (element instanceof IModelElement) {
return BeansModelLabels.getElementLabel((IModelElement) element, 0);
}
else if (element instanceof ZipEntryStorage) {
// create zip entry label right here as it is not a core model
// element
ZipEntryStorage storage = (ZipEntryStorage) element;
StringBuilder builder = new StringBuilder();
builder.append(storage.getFullPath().lastSegment());
builder.append(" - ");
builder.append(storage.getFile().getProjectRelativePath().toString());
builder.append("!");
builder.append(storage.getFullPath().removeLastSegments(1).toString());
return builder.toString();
}
else if (element instanceof BeanClassReferences) {
return BeansUIPlugin.getResourceString("BeanClassReferences.label");
}
else if (element instanceof BeanMetadataReference) {
IBeanMetadataLabelProvider labelProvider = BeanMetadataUtils.getLabelProvider((BeanMetadataReference) element);
if (labelProvider != null) {
return labelProvider.getText(element);
}
}
return super.getText(element, parentElement);
}