Search in sources :

Example 1 with MemberImplementorExplorer

use of com.intellij.codeInsight.MemberImplementorExplorer in project intellij-community by JetBrains.

the class OverrideImplementExploreUtil method collectMethodsToImplement.

public static void collectMethodsToImplement(PsiClass aClass, Map<MethodSignature, PsiMethod> abstracts, Map<MethodSignature, PsiMethod> finals, Map<MethodSignature, PsiMethod> concretes, Map<MethodSignature, CandidateInfo> result) {
    for (Map.Entry<MethodSignature, PsiMethod> entry : abstracts.entrySet()) {
        MethodSignature signature = entry.getKey();
        PsiMethod abstractOne = entry.getValue();
        PsiMethod concrete = concretes.get(signature);
        if (concrete == null || PsiUtil.getAccessLevel(concrete.getModifierList()) < PsiUtil.getAccessLevel(abstractOne.getModifierList()) || !abstractOne.getContainingClass().isInterface() && abstractOne.getContainingClass().isInheritor(concrete.getContainingClass(), true) || isDefaultMethod(aClass, abstractOne)) {
            if (finals.get(signature) == null) {
                PsiSubstitutor subst = correctSubstitutor(abstractOne, signature.getSubstitutor());
                CandidateInfo info = new CandidateInfo(abstractOne, subst);
                result.put(signature, info);
            }
        }
    }
    MemberImplementorExplorersProvider explorersProvider = ourExplorersProvider.getValue();
    if (explorersProvider != null) {
        for (final MemberImplementorExplorer implementor : explorersProvider.getExplorers()) {
            for (final PsiMethod method : implementor.getMethodsToImplement(aClass)) {
                MethodSignature signature = MethodSignatureUtil.createMethodSignature(method.getName(), method.getParameterList(), method.getTypeParameterList(), PsiSubstitutor.EMPTY, method.isConstructor());
                CandidateInfo info = new CandidateInfo(method, PsiSubstitutor.EMPTY);
                result.put(signature, info);
            }
        }
    }
}
Also used : CandidateInfo(com.intellij.psi.infos.CandidateInfo) MemberImplementorExplorer(com.intellij.codeInsight.MemberImplementorExplorer)

Aggregations

MemberImplementorExplorer (com.intellij.codeInsight.MemberImplementorExplorer)1 CandidateInfo (com.intellij.psi.infos.CandidateInfo)1