LibraryOrderEntry (@NotNull ModuleRootModel model, @NotNull String libraryName) { for (OrderEntry orderEntry : model.getOrderEntries()) { if (orderEntry instanceof LibraryOrderEntry) { final String libName = ((LibraryOrderEntry)orderEntry).getLibraryName(); if (libraryName.equals(libName)) { return (LibraryOrderEntry)orderEntry; } } } return null; }