int (PsiDirectory directory) { Iterator<PsiFile> iterator = myBuilder.getFiles(directory); int count = 0; try { while (iterator.hasNext()) { PsiFile psiFile = iterator.next(); if (getStructure().accept(psiFile)) { count++; } } } catch (IndexNotReadyException e) { return count; } return count; }