public void renderElement(LookupElementPresentation presentation) { presentation.setItemText(getLookupString()); presentation.setTypeText(parameter.getType().toString()); if (!parameter.getValue().isEmpty()) presentation.appendTailText("(" + parameter.getValue() + ")", true); presentation.setIcon(SilexIcons.Parameter); }
public static void renderClassItem( LookupElementPresentation presentation, LookupItem item, PsiClass psiClass, boolean diamond) { if (!(psiClass instanceof PsiTypeParameter)) { presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item, presentation.isReal())); } final boolean bold = item.getAttribute(LookupItem.HIGHLIGHTED_ATTR) != null; boolean strikeout = JavaElementLookupRenderer.isToStrikeout(item); presentation.setItemText(getName(psiClass, item, diamond)); presentation.setStrikeout(strikeout); presentation.setItemTextBold(bold); String tailText = StringUtil.notNullize((String) item.getAttribute(LookupItem.TAIL_TEXT_ATTR)); PsiSubstitutor substitutor = (PsiSubstitutor) item.getAttribute(LookupItem.SUBSTITUTOR); if (item instanceof PsiTypeLookupItem && ((PsiTypeLookupItem) item).isIndicateAnonymous() && (psiClass.isInterface() || psiClass.hasModifierProperty(PsiModifier.ABSTRACT))) { tailText = "{...}" + tailText; } if (substitutor == null && !diamond && psiClass.getTypeParameters().length > 0) { tailText = "<" + StringUtil.join( psiClass.getTypeParameters(), new Function<PsiTypeParameter, String>() { @Override public String fun(PsiTypeParameter psiTypeParameter) { return psiTypeParameter.getName(); } }, "," + (showSpaceAfterComma(psiClass) ? " " : "")) + ">" + tailText; } presentation.setTailText(tailText, true); }
@Override public void renderElement(LookupElementPresentation presentation) { super.renderElement(presentation); presentation.setTypeText(myTypeText); presentation.setIcon(PlatformIcons.METHOD_ICON); }