void (PsiElement[] psiElements, boolean checkAbstract, boolean checkIsTest, PsiElementProcessor.CollectElements<PsiElement> collectingProcessor) { for (PsiElement psiElement : psiElements) { if (psiElement instanceof PsiDirectory) { final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage((PsiDirectory)psiElement); if (aPackage != null && !collectingProcessor.execute(aPackage)) { return; } } else { psiElement = PsiTreeUtil.getNonStrictParentOfType(psiElement, PsiMember.class, PsiClassOwner.class); if (psiElement instanceof PsiClassOwner) { final PsiClass[] classes = ((PsiClassOwner)psiElement).getClasses(); for (PsiClass aClass : classes) { if ((!checkIsTest && isRequiredVisibility(aClass) || checkIsTest && isTestClass(aClass)) && !collectingProcessor.execute(aClass)) { return; } } } else if (psiElement instanceof PsiClass) { if ((!checkIsTest && isRequiredVisibility((PsiClass)psiElement) || checkIsTest && isTestClass((PsiClass)psiElement)) && !collectingProcessor.execute(psiElement)) { return; } } else if (psiElement instanceof PsiMethod) { if (checkIsTest && isTestMethod(checkAbstract, (PsiMethod)psiElement) && !collectingProcessor.execute(psiElement)) { return; } if (!checkIsTest) { final PsiClass containingClass = ((PsiMethod)psiElement).getContainingClass(); if (containingClass != null && isRequiredVisibility(containingClass) && !collectingProcessor.execute(psiElement)) { return; } } } } } }