boolean (LibraryTable.ModifiableModel table, String libraryName) { for (Iterator<Library> it = table.getLibraryIterator(); it.hasNext(); ) { final Library library = it.next(); final String libName; if (table instanceof LibrariesModifiableModel){ libName = ((LibrariesModifiableModel)table).getLibraryEditor(library).getName(); } else { libName = library.getName(); } if (libraryName.equals(libName)) { return true; } } return false; }