void (@NotNull final AnActionEvent e) { final Object o = getSelectedObject(); if (o instanceof LibraryEx selected) { final String newName = Messages.showInputDialog(JavaUiBundle.message("label.enter.library.name"), JavaUiBundle.message( "dialog.title.copy.library"), null, selected.getName() + "2", new NonEmptyInputValidator()); if (newName == null) return; BaseLibrariesConfigurable configurable = BaseLibrariesConfigurable.this; final LibraryEx library = (LibraryEx)myContext.getLibrary(selected.getName(), myLevel); LOG.assertTrue(library != null); final LibrariesModifiableModel libsModel = configurable.getModelProvider().getModifiableModel(); final Library lib = libsModel.createLibrary(newName, library.getKind()); final LibraryEx.ModifiableModelEx model = libsModel.getLibraryEditor(lib).getModel(); LibraryEditingUtil.copyLibrary(library, Collections.emptyMap(), model); } }