void (final ArrayList<PsiElement> array, final PsiElement psiElement) { if (psiElement instanceof PyFile) { for (PyClass pyClass : ((PyFile)psiElement).getTopLevelClasses()) { addNavigationElements(array, pyClass); } for (PyFunction pyFunction : ((PyFile)psiElement).getTopLevelFunctions()) { addNavigationElements(array, pyFunction); } } else if (psiElement instanceof PyFunction){ array.add(psiElement); } else if (psiElement instanceof PyClass) { Collections.addAll(array, ((PyClass)psiElement).getMethods()); } }