void (Library library, VirtualFile vFile) { final Library.ModifiableModel modifiableModel = library.getModifiableModel(); modifiableModel.addRoot(vFile.getUrl(), OrderRootType.CLASSES); ApplicationManager.getApplication().runWriteAction(() -> modifiableModel.commit()); }