boolean (final VirtualFile parentDirectory, final int curLevel, final int maxLevel, final Processor<? super VirtualFile> processor) { final VirtualFile[] files = parentDirectory.getChildren(); if (files != null) { for (VirtualFile file : files) { if (file.isDirectory()) { if (curLevel < maxLevel) { if (!processFileRecursively(file, curLevel + 1, maxLevel, processor)) { return false; } } } else if (!processor.process(file)) { return false; } } } return true; }