Module (@NotNull Project project, @Nullable ModifiableModuleModel model) { Module module = super.commitModule(project, model); if (module != null && myGenerator != null) { ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); VirtualFile[] contentRoots = moduleRootManager.getContentRoots(); VirtualFile dir = module.getProject().getBaseDir(); if (contentRoots.length > 0 && contentRoots[0] != null) { dir = contentRoots[0]; } myGenerator.generateProject(project, dir, NO_SETTINGS, module); } return module; }