mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
@NotNull matcher
This commit is contained in:
@@ -416,9 +416,9 @@ public class JavaCompletionUtil {
|
||||
}
|
||||
|
||||
public static Set<LookupElement> processJavaReference(PsiElement element, PsiJavaReference javaReference, ElementFilter elementFilter,
|
||||
final boolean checkAccess, boolean filterStaticAfterInstance, @Nullable final PrefixMatcher matcher, CompletionParameters parameters) {
|
||||
final boolean checkAccess, boolean filterStaticAfterInstance, final PrefixMatcher matcher, CompletionParameters parameters) {
|
||||
final THashSet<LookupElement> set = new THashSet<LookupElement>();
|
||||
final Condition<String> nameCondition = matcher == null ? null : new Condition<String>() {
|
||||
final Condition<String> nameCondition = new Condition<String>() {
|
||||
public boolean value(String s) {
|
||||
return matcher.prefixMatches(s);
|
||||
}
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@ public class JavaSmartCompletionContributor extends CompletionContributor {
|
||||
final ElementFilter filter,
|
||||
final boolean acceptClasses,
|
||||
final boolean acceptMembers,
|
||||
CompletionParameters parameters, @Nullable final PrefixMatcher matcher) {
|
||||
CompletionParameters parameters, final PrefixMatcher matcher) {
|
||||
if (reference instanceof PsiMultiReference) {
|
||||
reference = ContainerUtil.findInstance(((PsiMultiReference) reference).getReferences(), PsiJavaReference.class);
|
||||
}
|
||||
|
||||
+2
-2
@@ -138,7 +138,7 @@ public class ReferenceExpressionCompletionContributor {
|
||||
final boolean secondTime = parameters.getParameters().getInvocationCount() >= 2;
|
||||
|
||||
final Set<LookupElement> base =
|
||||
JavaSmartCompletionContributor.completeReference(element, reference, filter, false, true, parameters.getParameters(), null);
|
||||
JavaSmartCompletionContributor.completeReference(element, reference, filter, false, true, parameters.getParameters(), PrefixMatcher.ALWAYS_TRUE);
|
||||
for (final LookupElement item : new LinkedHashSet<LookupElement>(base)) {
|
||||
ExpressionLookupItem access = getSingleArrayElementAccess(element, item);
|
||||
if (access != null) {
|
||||
@@ -200,7 +200,7 @@ public class ReferenceExpressionCompletionContributor {
|
||||
public boolean isClassAcceptable(Class hintClass) {
|
||||
return true;
|
||||
}
|
||||
}), false, true, parameters.getParameters(), null);
|
||||
}), false, true, parameters.getParameters(), PrefixMatcher.ALWAYS_TRUE);
|
||||
for (LookupElement lookupElement : elements) {
|
||||
if (lookupElement.getObject() instanceof PsiMethod) {
|
||||
final JavaMethodCallElement item = lookupElement.as(JavaMethodCallElement.CLASS_CONDITION_KEY);
|
||||
|
||||
@@ -122,18 +122,18 @@ public abstract class StaticMemberProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
public List<PsiMember> processMembersOfRegisteredClasses(@Nullable final PrefixMatcher matcher, PairConsumer<PsiMember, PsiClass> consumer) {
|
||||
public List<PsiMember> processMembersOfRegisteredClasses(final PrefixMatcher matcher, PairConsumer<PsiMember, PsiClass> consumer) {
|
||||
final ArrayList<PsiMember> result = CollectionFactory.arrayList();
|
||||
for (final PsiClass psiClass : myStaticImportedClasses) {
|
||||
for (final PsiMethod method : psiClass.getAllMethods()) {
|
||||
if (matcher == null || matcher.prefixMatches(method.getName())) {
|
||||
if (matcher.prefixMatches(method.getName())) {
|
||||
if (isStaticallyImportable(method)) {
|
||||
consumer.consume(method, psiClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (final PsiField field : psiClass.getAllFields()) {
|
||||
if (matcher == null || matcher.prefixMatches(field. getName())) {
|
||||
if (matcher.prefixMatches(field. getName())) {
|
||||
if (isStaticallyImportable(field)) {
|
||||
consumer.consume(field, psiClass);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.psi.filters.getters;
|
||||
import com.intellij.codeInsight.CodeInsightUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.JavaCompletionUtil;
|
||||
import com.intellij.codeInsight.completion.PrefixMatcher;
|
||||
import com.intellij.codeInsight.completion.StaticMemberProcessor;
|
||||
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
@@ -61,7 +62,7 @@ public abstract class MembersGetter {
|
||||
}
|
||||
|
||||
final Set<PsiMember> importedStatically = new HashSet<PsiMember>();
|
||||
processor.processMembersOfRegisteredClasses(null, new PairConsumer<PsiMember, PsiClass>() {
|
||||
processor.processMembersOfRegisteredClasses(PrefixMatcher.ALWAYS_TRUE, new PairConsumer<PsiMember, PsiClass>() {
|
||||
@Override
|
||||
public void consume(PsiMember member, PsiClass psiClass) {
|
||||
importedStatically.add(member);
|
||||
|
||||
Reference in New Issue
Block a user