private static void addSuperSignatureElements( final PsiClass parent, boolean implemented, CompletionResultSet result, Set<MethodSignature> addedSignatures) { for (CandidateInfo candidate : OverrideImplementExploreUtil.getMethodsToOverrideImplement(parent, implemented)) { PsiMethod baseMethod = (PsiMethod) candidate.getElement(); PsiClass baseClass = baseMethod.getContainingClass(); PsiSubstitutor substitutor = candidate.getSubstitutor(); if (!baseMethod.isConstructor() && baseClass != null && addedSignatures.add(baseMethod.getSignature(substitutor))) { result.addElement( createOverridingLookupElement(implemented, baseMethod, baseClass, substitutor)); } } }
private static void addGetterSetterElements( CompletionResultSet result, PsiClass parent, Set<MethodSignature> addedSignatures) { int count = 0; for (PsiField field : parent.getFields()) { if (field instanceof PsiEnumConstant) continue; List<PsiMethod> prototypes = ContainerUtil.newSmartList(); Collections.addAll( prototypes, GetterSetterPrototypeProvider.generateGetterSetters(field, true)); Collections.addAll( prototypes, GetterSetterPrototypeProvider.generateGetterSetters(field, false)); for (final PsiMethod prototype : prototypes) { if (parent.findMethodBySignature(prototype, false) == null && addedSignatures.add(prototype.getSignature(PsiSubstitutor.EMPTY))) { Icon icon = prototype.getIcon(Iconable.ICON_FLAG_VISIBILITY); result.addElement( createGenerateMethodElement( prototype, PsiSubstitutor.EMPTY, icon, "", new InsertHandler<LookupElement>() { @Override public void handleInsert(InsertionContext context, LookupElement item) { removeLookupString(context); insertGenerationInfos( context, Collections.singletonList(new PsiGenerationInfo<PsiMethod>(prototype))); } })); if (count++ > 100) return; } } } }