diff options
Diffstat (limited to 'platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java')
-rw-r--r-- | platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java | 36 |
1 files changed, 36 insertions, 0 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 189e6581d171..771ca526b5fe 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java +++ b/platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java @@ -23,6 +23,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiNamedElement; import com.intellij.psi.util.PsiUtilCore; import gnu.trove.THashSet; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -85,10 +86,12 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withInsertHandler(com.intellij.codeInsight.completion.InsertHandler)} */ + @Contract(value="", pure=true) public LookupElementBuilder setInsertHandler(@Nullable InsertHandler<LookupElement> insertHandler) { return withInsertHandler(insertHandler); } + @Contract(value="", pure=true) public LookupElementBuilder withInsertHandler(@Nullable InsertHandler<LookupElement> insertHandler) { return new LookupElementBuilder(myLookupString, myObject, insertHandler, myRenderer, myHardcodedPresentation, myAllLookupStrings, myCaseSensitive); @@ -97,9 +100,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withRenderer(LookupElementRenderer)} */ + @Contract(value="", pure=true) public LookupElementBuilder setRenderer(@Nullable LookupElementRenderer<LookupElement> renderer) { return withRenderer(renderer); } + @Contract(value="", pure=true) public LookupElementBuilder withRenderer(@Nullable LookupElementRenderer<LookupElement> renderer) { return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, renderer, myHardcodedPresentation, myAllLookupStrings, myCaseSensitive); @@ -114,10 +119,12 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withIcon(javax.swing.Icon)} */ + @Contract(value="", pure=true) public LookupElementBuilder setIcon(@Nullable Icon icon) { return withIcon(icon); } + @Contract(value="", pure=true) public LookupElementBuilder withIcon(@Nullable Icon icon) { final LookupElementPresentation presentation = copyPresentation(); presentation.setIcon(icon); @@ -139,9 +146,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withLookupString(String)} */ + @Contract(value="", pure=true) public LookupElementBuilder addLookupString(@NotNull String another) { return withLookupString(another); } + @Contract(value="", pure=true) public LookupElementBuilder withLookupString(@NotNull String another) { final THashSet<String> set = new THashSet<String>(myAllLookupStrings); set.add(another); @@ -157,6 +166,7 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withCaseSensitivity(boolean)} */ + @Contract(value="", pure=true) public LookupElementBuilder setCaseSensitive(boolean caseSensitive) { return withCaseSensitivity(caseSensitive); } @@ -165,6 +175,7 @@ public final class LookupElementBuilder extends LookupElement { * @return modified builder * @see com.intellij.codeInsight.completion.CompletionResultSet#caseInsensitive() */ + @Contract(value="", pure=true) public LookupElementBuilder withCaseSensitivity(boolean caseSensitive) { return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, myRenderer, myHardcodedPresentation, myAllLookupStrings, caseSensitive); @@ -173,9 +184,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withItemTextForeground(java.awt.Color)} */ + @Contract(value="", pure=true) public LookupElementBuilder setItemTextForeground(@NotNull Color itemTextForeground) { return withItemTextForeground(itemTextForeground); } + @Contract(value="", pure=true) public LookupElementBuilder withItemTextForeground(@NotNull Color itemTextForeground) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemTextForeground(itemTextForeground); @@ -185,9 +198,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withItemTextUnderlined(boolean)} */ + @Contract(value="", pure=true) public LookupElementBuilder setItemTextUnderlined(boolean underlined) { return withItemTextUnderlined(underlined); } + @Contract(value="", pure=true) public LookupElementBuilder withItemTextUnderlined(boolean underlined) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemTextUnderlined(underlined); @@ -197,9 +212,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withTypeText(String)} */ + @Contract(value="", pure=true) public LookupElementBuilder setTypeText(@Nullable String typeText) { return withTypeText(typeText); } + @Contract(value="", pure=true) public LookupElementBuilder withTypeText(@Nullable String typeText) { return withTypeText(typeText, false); } @@ -207,14 +224,17 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withTypeText(String, boolean)} */ + @Contract(value="", pure=true) public LookupElementBuilder setTypeText(@Nullable String typeText, boolean grayed) { return withTypeText(typeText, grayed); } + @Contract(value="", pure=true) public LookupElementBuilder withTypeText(@Nullable String typeText, boolean grayed) { return withTypeText(typeText, null, grayed); } + @Contract(value="", pure=true) public LookupElementBuilder withTypeText(@Nullable String typeText, @Nullable Icon typeIcon, boolean grayed) { final LookupElementPresentation presentation = copyPresentation(); presentation.setTypeText(typeText, typeIcon); @@ -226,9 +246,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withPresentableText(String)} */ + @Contract(value="", pure=true) public LookupElementBuilder setPresentableText(@NotNull String presentableText) { return withPresentableText(presentableText); } + @Contract(value="", pure=true) public LookupElementBuilder withPresentableText(@NotNull String presentableText) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemText(presentableText); @@ -239,9 +261,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #bold()} */ + @Contract(value="", pure=true) public LookupElementBuilder setBold() { return bold(); } + @Contract(value="", pure=true) public LookupElementBuilder bold() { return withBoldness(true); } @@ -249,9 +273,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withBoldness(boolean)} */ + @Contract(value="", pure=true) public LookupElementBuilder setBold(boolean bold) { return withBoldness(bold); } + @Contract(value="", pure=true) public LookupElementBuilder withBoldness(boolean bold) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemTextBold(bold); @@ -262,9 +288,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #strikeout()} */ + @Contract(value="", pure=true) public LookupElementBuilder setStrikeout() { return strikeout(); } + @Contract(value="", pure=true) public LookupElementBuilder strikeout() { return withStrikeoutness(true); } @@ -272,9 +300,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withStrikeoutness(boolean)} */ + @Contract(value="", pure=true) public LookupElementBuilder setStrikeout(boolean strikeout) { return withStrikeoutness(strikeout); } + @Contract(value="", pure=true) public LookupElementBuilder withStrikeoutness(boolean strikeout) { final LookupElementPresentation presentation = copyPresentation(); presentation.setStrikeout(strikeout); @@ -285,9 +315,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withTailText(String)} */ + @Contract(value="", pure=true) public LookupElementBuilder setTailText(@Nullable String tailText) { return withTailText(tailText); } + @Contract(value="", pure=true) public LookupElementBuilder withTailText(@Nullable String tailText) { return withTailText(tailText, false); } @@ -295,9 +327,11 @@ public final class LookupElementBuilder extends LookupElement { /** * @deprecated use {@link #withTailText(String, boolean)} */ + @Contract(value="", pure=true) public LookupElementBuilder setTailText(@Nullable String tailText, boolean grayed) { return withTailText(tailText, grayed); } + @Contract(value="", pure=true) public LookupElementBuilder withTailText(@Nullable String tailText, boolean grayed) { final LookupElementPresentation presentation = copyPresentation(); presentation.setTailText(tailText, grayed); @@ -305,12 +339,14 @@ public final class LookupElementBuilder extends LookupElement { myAllLookupStrings, myCaseSensitive); } + @Contract(value="", pure=true) public LookupElementBuilder appendTailText(@NotNull String tailText, boolean grayed) { final LookupElementPresentation presentation = copyPresentation(); presentation.appendTailText(tailText, grayed); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } + @Contract(value="", pure=true) public LookupElement withAutoCompletionPolicy(AutoCompletionPolicy policy) { return policy.applyPolicy(this); } |