From b4495f923dc963f08d21f8205c4e5e8f8e048ee5 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Tue, 10 Jun 2014 20:42:54 +0400 Subject: [PATCH] Allow to set typeIcon via LookupElementBuilder --- .../codeInsight/lookup/LookupElementBuilder.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java index 9b980c50198c..189e6581d171 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java +++ b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -210,9 +210,14 @@ public final class LookupElementBuilder extends LookupElement { public LookupElementBuilder setTypeText(@Nullable String typeText, boolean grayed) { return withTypeText(typeText, grayed); } + public LookupElementBuilder withTypeText(@Nullable String typeText, boolean grayed) { + return withTypeText(typeText, null, grayed); + } + + public LookupElementBuilder withTypeText(@Nullable String typeText, @Nullable Icon typeIcon, boolean grayed) { final LookupElementPresentation presentation = copyPresentation(); - presentation.setTypeText(typeText); + presentation.setTypeText(typeText, typeIcon); presentation.setTypeGrayed(grayed); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive);