Search in sources :

Example 1 with Iconable

use of com.intellij.openapi.util.Iconable in project intellij-community by JetBrains.

the class DefaultLookupItemRenderer method _getRawIcon.

@Nullable
private static Icon _getRawIcon(LookupElement item, boolean real) {
    if (item instanceof LookupItem) {
        Icon icon = (Icon) ((LookupItem) item).getAttribute(LookupItem.ICON_ATTR);
        if (icon != null)
            return icon;
    }
    Object o = item.getObject();
    if (!real) {
        if (item.getObject() instanceof String) {
            return EmptyIcon.ICON_0;
        }
        return EmptyIcon.create(SAMPLE_ICON.getIconWidth() * 2, SAMPLE_ICON.getIconHeight());
    }
    if (o instanceof Iconable && !(o instanceof PsiElement)) {
        return ((Iconable) o).getIcon(Iconable.ICON_FLAG_VISIBILITY);
    }
    final PsiElement element = item.getPsiElement();
    if (element != null && element.isValid()) {
        return element.getIcon(Iconable.ICON_FLAG_VISIBILITY);
    }
    return null;
}
Also used : Iconable(com.intellij.openapi.util.Iconable) SizedIcon(com.intellij.ui.SizedIcon) ScalableJBIcon(com.intellij.util.ui.JBUI.ScalableJBIcon) ScalableIcon(com.intellij.openapi.util.ScalableIcon) EmptyIcon(com.intellij.util.ui.EmptyIcon) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Iconable (com.intellij.openapi.util.Iconable)1 ScalableIcon (com.intellij.openapi.util.ScalableIcon)1 PsiElement (com.intellij.psi.PsiElement)1 SizedIcon (com.intellij.ui.SizedIcon)1 EmptyIcon (com.intellij.util.ui.EmptyIcon)1 ScalableJBIcon (com.intellij.util.ui.JBUI.ScalableJBIcon)1 Nullable (org.jetbrains.annotations.Nullable)1