Library (Library library, final String libraryName, final String libraryLevel) { final StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(myProject).getContext(); if (library == null) { if (libraryName != null) { library = context.getLibrary(libraryName, libraryLevel); } } else { final Library model = context.getLibraryModel(library); if (model != null) { library = model; } library = context.getLibrary(library.getName(), library.getTable().getTableLevel()); } return library; }