Library (@NotNull NewLibraryEditor libraryEditor, @NotNull LibraryLevel level) { LibraryTableModifiableModelProvider provider = getProvider(level); if (provider == null) { LOG.error("cannot create module library in this context"); } LibraryTable.ModifiableModel model = provider.getModifiableModel(); final LibraryType<?> type = libraryEditor.getType(); Library library = model.createLibrary(getUniqueLibraryName(libraryEditor.getName(), model), type == null ? null : type.getKind()); ExistingLibraryEditor createdLibraryEditor = ((LibrariesModifiableModel)model).getLibraryEditor(library); createdLibraryEditor.setProperties(libraryEditor.getProperties()); libraryEditor.applyTo(createdLibraryEditor); return library; }