Search in sources :

Example 1 with ModuleImpl

use of com.intellij.openapi.module.impl.ModuleImpl in project intellij-community by JetBrains.

the class ModuleTestCase method loadAllModulesUnder.

@Nullable
protected Module loadAllModulesUnder(@NotNull VirtualFile rootDir, @Nullable final Consumer<Module> moduleConsumer) {
    final Ref<Module> result = Ref.create();
    VfsUtilCore.visitChildrenRecursively(rootDir, new VirtualFileVisitor() {

        @Override
        public boolean visitFile(@NotNull VirtualFile file) {
            if (!file.isDirectory() && file.getName().endsWith(ModuleFileType.DOT_DEFAULT_EXTENSION)) {
                ModuleImpl module = (ModuleImpl) loadModule(file);
                if (moduleConsumer != null) {
                    moduleConsumer.consume(module);
                }
                result.setIfNull(module);
            }
            return true;
        }
    });
    return result.get();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ModuleImpl(com.intellij.openapi.module.impl.ModuleImpl) Module(com.intellij.openapi.module.Module) VirtualFileVisitor(com.intellij.openapi.vfs.VirtualFileVisitor) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Module (com.intellij.openapi.module.Module)1 ModuleImpl (com.intellij.openapi.module.impl.ModuleImpl)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 VirtualFileVisitor (com.intellij.openapi.vfs.VirtualFileVisitor)1 Nullable (org.jetbrains.annotations.Nullable)1