ItemPresentation () { final PyElement element = getValue(); final ItemPresentation presentation = element != null ? element.getPresentation() : null; return new ColoredItemPresentation() { @Nullable @Override public String getPresentableText() { if (element instanceof PyFile) { return element.getName(); } return presentation != null ? presentation.getPresentableText() : PyNames.UNNAMED_ELEMENT; } @Nullable @Override public TextAttributesKey getTextAttributesKey() { if (isInherited()) { return CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES; } return null; } @Nullable @Override public Icon getIcon(boolean open) { if (element == null) { return null; } Icon normal_icon = element.getIcon(0); if (myIcon != null) normal_icon = myIcon; // override normal if (myVisibility == Visibility.NORMAL) { return normal_icon; } else { LayeredIcon icon = new LayeredIcon(2); icon.setIcon(normal_icon, 0); Icon overlay = null; if (myVisibility == Visibility.PRIVATE || myVisibility == Visibility.PROTECTED) { overlay = PythonPsiApiIcons.Nodes.Lock; } else if (myVisibility == Visibility.PREDEFINED) { overlay = PythonPsiApiIcons.Nodes.CyanDot; } else if (myVisibility == Visibility.INVISIBLE) { overlay = PythonPsiApiIcons.Nodes.RedInvTriangle; } if (overlay != null) { icon.setIcon(overlay, 1); } return icon; } } }; }