LibraryOrderEntry (@NotNull ModuleRootModel model, @Nullable Library library) { if (library == null) return null; for (OrderEntry orderEntry : model.getOrderEntries()) { if (orderEntry instanceof LibraryOrderEntry && library.equals(((LibraryOrderEntry)orderEntry).getLibrary())) { return (LibraryOrderEntry)orderEntry; } } return null; }