return non-null descriptive name for elements that don't have a name (PY-1552)

This commit is contained in:
Dmitry Jemerov
2010-08-17 21:35:40 +04:00
parent bd055286cd
commit 4684b8c13e
@@ -46,12 +46,13 @@ public class PythonFindUsagesProvider implements FindUsagesProvider {
@NotNull
public String getDescriptiveName(@NotNull PsiElement element) {
if (element instanceof PsiNamedElement) {
return ((PsiNamedElement)element).getName();
final String name = ((PsiNamedElement)element).getName();
return name == null ? "<unnamed>" : name;
}
if (element instanceof PyReferenceExpression) {
String referencedName = ((PyReferenceExpression)element).getReferencedName();
if (referencedName == null) {
return "";
return "<unnamed>";
}
return referencedName;
}