mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-86431 Rename methods LookupElementBuilder.setXXX to withXXX
This commit is contained in:
@@ -43,7 +43,7 @@ public class ClassByNameMerger implements Consumer<LookupElement> {
|
||||
if (lastElement != null) {
|
||||
if (lastElement.getLookupString().equals(element.getLookupString())) {
|
||||
number++;
|
||||
lastElement = LookupElementBuilder.create(element.getLookupString()).setTailText(" (" + number + " variants...)", true);
|
||||
lastElement = LookupElementBuilder.create(element.getLookupString()).withTailText(" (" + number + " variants...)", true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+11
-10
@@ -36,7 +36,8 @@ public class JavaLookupElementBuilder {
|
||||
public static LookupElementBuilder forField(@NotNull PsiField field,
|
||||
final String lookupString,
|
||||
final @Nullable PsiClass qualifierClass) {
|
||||
final LookupElementBuilder builder = LookupElementBuilder.create(field, lookupString).setIcon(field.getIcon(Iconable.ICON_FLAG_VISIBILITY));
|
||||
final LookupElementBuilder builder = LookupElementBuilder.create(field, lookupString).withIcon(
|
||||
field.getIcon(Iconable.ICON_FLAG_VISIBILITY));
|
||||
return setBoldIfInClass(field, qualifierClass, builder);
|
||||
}
|
||||
|
||||
@@ -48,14 +49,14 @@ public class JavaLookupElementBuilder {
|
||||
@NotNull String lookupString, final @NotNull PsiSubstitutor substitutor,
|
||||
@Nullable PsiClass qualifierClass) {
|
||||
LookupElementBuilder builder = LookupElementBuilder.create(method, lookupString)
|
||||
.setIcon(method.getIcon(Iconable.ICON_FLAG_VISIBILITY))
|
||||
.setPresentableText(method.getName())
|
||||
.setTailText(PsiFormatUtil.formatMethod(method, substitutor,
|
||||
PsiFormatUtil.SHOW_PARAMETERS,
|
||||
PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_TYPE));
|
||||
.withIcon(method.getIcon(Iconable.ICON_FLAG_VISIBILITY))
|
||||
.withPresentableText(method.getName())
|
||||
.withTailText(PsiFormatUtil.formatMethod(method, substitutor,
|
||||
PsiFormatUtil.SHOW_PARAMETERS,
|
||||
PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_TYPE));
|
||||
final PsiType returnType = method.getReturnType();
|
||||
if (returnType != null) {
|
||||
builder = builder.setTypeText(substitutor.substitute(returnType).getPresentableText());
|
||||
builder = builder.withTypeText(substitutor.substitute(returnType).getPresentableText());
|
||||
}
|
||||
builder = setBoldIfInClass(method, qualifierClass, builder);
|
||||
return builder;
|
||||
@@ -63,7 +64,7 @@ public class JavaLookupElementBuilder {
|
||||
|
||||
private static LookupElementBuilder setBoldIfInClass(@NotNull PsiMember member, @Nullable PsiClass psiClass, @NotNull LookupElementBuilder builder) {
|
||||
if (psiClass != null && member.getManager().areElementsEquivalent(member.getContainingClass(), psiClass)) {
|
||||
return builder.setBold();
|
||||
return builder.bold();
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
@@ -81,9 +82,9 @@ public class JavaLookupElementBuilder {
|
||||
final String lookupString,
|
||||
final boolean withLocation) {
|
||||
final LookupElementBuilder builder =
|
||||
LookupElementBuilder.create(psiClass, lookupString).setIcon(psiClass.getIcon(Iconable.ICON_FLAG_VISIBILITY));
|
||||
LookupElementBuilder.create(psiClass, lookupString).withIcon(psiClass.getIcon(Iconable.ICON_FLAG_VISIBILITY));
|
||||
if (withLocation) {
|
||||
return builder.setTailText(" (" + PsiFormatUtil.getPackageDisplayName(psiClass) + ")", true);
|
||||
return builder.withTailText(" (" + PsiFormatUtil.getPackageDisplayName(psiClass) + ")", true);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
+3
-3
@@ -345,9 +345,9 @@ public class JavaMemberNameCompletionContributor extends CompletionContributor {
|
||||
|
||||
if (ourClassParent.isAnnotationType() && matcher.prefixMatches(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME)) {
|
||||
set.add(LookupElementBuilder.create(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME)
|
||||
.setIcon(PlatformIcons.METHOD_ICON)
|
||||
.setTailText("()")
|
||||
.setInsertHandler(ParenthesesInsertHandler.NO_PARAMETERS));
|
||||
.withIcon(PlatformIcons.METHOD_ICON)
|
||||
.withTailText("()")
|
||||
.withInsertHandler(ParenthesesInsertHandler.NO_PARAMETERS));
|
||||
}
|
||||
|
||||
addLookupItems(set, null, matcher, element.getProject(), getUnresolvedReferences(ourClassParent, true));
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ class SameSignatureCallParametersProvider extends CompletionProvider<CompletionP
|
||||
icon.setIcon(PlatformIcons.PARAMETER_ICON, 0, 2*w/5, 0);
|
||||
icon.setIcon(PlatformIcons.PARAMETER_ICON, 1);
|
||||
|
||||
final LookupElement element = LookupElementBuilder.create(lookupString).setIcon(icon);
|
||||
final LookupElement element = LookupElementBuilder.create(lookupString).withIcon(icon);
|
||||
element.putUserData(JavaCompletionUtil.SUPER_METHOD_PARAMETERS, Boolean.TRUE);
|
||||
|
||||
return TailTypeDecorator.withTail(element, ExpectedTypesProvider.getFinalCallParameterTailType(call, invoked.getReturnType(), invoked));
|
||||
|
||||
+2
-2
@@ -139,14 +139,14 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix {
|
||||
@Override
|
||||
public LookupElement[] calculateLookupItems(ExpressionContext context) {
|
||||
Set<LookupElement> set = new LinkedHashSet<LookupElement>();
|
||||
set.add(JavaLookupElementBuilder.forField(myField).setTypeText(myField.getType().getPresentableText()));
|
||||
set.add(JavaLookupElementBuilder.forField(myField).withTypeText(myField.getType().getPresentableText()));
|
||||
PsiField[] fields = myClass.getFields();
|
||||
for (PsiField otherField : fields) {
|
||||
if (!myDefaultFieldName.equals(otherField.getName())) {
|
||||
PsiType otherType = otherField.getType();
|
||||
for (PsiType type : myExpectedTypes) {
|
||||
if (type.equals(otherType)) {
|
||||
set.add(JavaLookupElementBuilder.forField(otherField).setTypeText(otherType.getPresentableText()));
|
||||
set.add(JavaLookupElementBuilder.forField(otherField).withTypeText(otherType.getPresentableText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ public class JavaLangClassMemberReference extends PsiReferenceBase<PsiLiteralExp
|
||||
final List<LookupElementBuilder> elements = new ArrayList<LookupElementBuilder>();
|
||||
for (PsiMethod method : psiClass.getMethods()) {
|
||||
if (type == Type.DECLARED_METHOD || isPublic(method)) {
|
||||
elements.add(JavaLookupElementBuilder.forMethod(method, PsiSubstitutor.EMPTY).setInsertHandler(this));
|
||||
elements.add(JavaLookupElementBuilder.forMethod(method, PsiSubstitutor.EMPTY).withInsertHandler(this));
|
||||
}
|
||||
}
|
||||
return elements.toArray();
|
||||
|
||||
+1
-1
@@ -563,7 +563,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return JavaLookupElementBuilder.forClass(clazz, name, true).addLookupString(qname).addLookupString(clazz.getName());
|
||||
return JavaLookupElementBuilder.forClass(clazz, name, true).withLookupString(qname).withLookupString(clazz.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -347,7 +347,7 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
|
||||
|
||||
for (String completionVariant : info.names) {
|
||||
final LookupElementBuilder element = LookupElementBuilder.create(completionVariant);
|
||||
result.addElement(element.addLookupString(completionVariant.toLowerCase()));
|
||||
result.addElement(element.withLookupString(completionVariant.toLowerCase()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user