void () { // add all paths to library final ModifiableRootModel model = existingModel != null ? existingModel : modelsProvider.getModuleModifiableModel(module); final LibraryOrderEntry orderEntry = OrderEntryUtil.findLibraryOrderEntry(model, libraryName); if (orderEntry != null) { // update existing Library lib = orderEntry.getLibrary(); if (lib != null) { if (lib instanceof LibraryEx && ((LibraryEx)lib).getKind() == null) { // replace old python libraries with python specific ones model.removeOrderEntry(orderEntry); LibraryTablesRegistrar.getInstance().getLibraryTable(model.getProject()).removeLibrary(lib); createNewLibrary(model); return; } fillLibrary(lib, paths); if (existingModel == null) { modelsProvider.commitModuleModifiableModel(model); } return; } } // create new createNewLibrary(model); }