Computable<Collection<Module>> (final @NotNull Collection<? extends DataNode<ModuleData>> toImport, final @NotNull ProjectData projectData, final @NotNull Project project, final @NotNull IdeModifiableModelsProvider modelsProvider) { return () -> { List<Module> orphanIdeModules = new SmartList<>(); for (Module module : modelsProvider.getModules()) { if (!ExternalSystemApiUtil.isExternalSystemAwareModule(projectData.getOwner(), module)) continue; if (ExternalSystemApiUtil.getExternalModuleType(module) != null) continue; final String rootProjectPath = ExternalSystemApiUtil.getExternalRootProjectPath(module); if (projectData.getLinkedExternalProjectPath().equals(rootProjectPath)) { if (module.getUserData(AbstractModuleDataService.MODULE_DATA_KEY) == null) { orphanIdeModules.add(module); } } } return orphanIdeModules; }; }