void (@NotNull IdeModifiableModelsProvider modelsProvider, @NotNull Set<LibraryDependencyData> toImport, @NotNull Map<OrderEntry, OrderAware> orderEntryDataMap, @NotNull ModifiableRootModel moduleRootModel, @NotNull LibraryTable moduleLibraryTable, @NotNull Module module) { for (final LibraryDependencyData dependencyData : toImport) { final LibraryData libraryData = dependencyData.getTarget(); final String libraryName = libraryData.getInternalName(); switch (dependencyData.getLevel()) { case MODULE -> { final Library moduleLib; if (libraryName.isEmpty()) { moduleLib = moduleLibraryTable.createLibrary(); } else { moduleLib = moduleLibraryTable.createLibrary(libraryName); } final LibraryOrderEntry existingLibraryDependency = syncExistingLibraryDependency(modelsProvider, dependencyData, moduleLib, moduleRootModel, module); orderEntryDataMap.put(existingLibraryDependency, dependencyData); } case PROJECT -> { final Library projectLib = modelsProvider.getLibraryByName(libraryName); if (projectLib == null) { final LibraryOrderEntry existingProjectLibraryDependency = syncExistingLibraryDependency( modelsProvider, dependencyData, moduleLibraryTable.createLibrary(libraryName), moduleRootModel, module); orderEntryDataMap.put(existingProjectLibraryDependency, dependencyData); break; } LibraryOrderEntry orderEntry = moduleRootModel.addLibraryEntry(projectLib); setLibraryScope(orderEntry, projectLib, module, dependencyData); ModuleOrderEntry substitutionEntry = modelsProvider.trySubstitute(module, orderEntry, libraryData); if (substitutionEntry != null) { orderEntryDataMap.put(substitutionEntry, dependencyData); } else { orderEntryDataMap.put(orderEntry, dependencyData); } } } } }