void (@NotNull final PackageManagementService packageManagementService) { final Application application = ApplicationManager.getApplication(); application.executeOnPooledThread(() -> { if (packageManagementService == myPackageManagementService) { try { List<RepoPackage> packages = packageManagementService.reloadAllPackages(); final Map<String, RepoPackage> packageMap = buildNameToPackageMap(packages); application.invokeLater(() -> { for (int i = 0; i != myPackagesTableModel.getRowCount(); ++i) { final InstalledPackage pyPackage = (InstalledPackage)myPackagesTableModel.getValueAt(i, 0); final RepoPackage repoPackage = packageMap.get(pyPackage.getName()); myPackagesTableModel.setValueAt(repoPackage == null ? null : repoPackage.getLatestVersion(), i, 2); } myPackagesTable.setPaintBusy(!myCurrentlyInstalling.isEmpty()); }, ModalityState.stateForComponent(myPackagesTable)); } catch (IOException ignored) { LOG.warn("Cannot refresh the list of available packages with their latest versions", ignored); myPackagesTable.setPaintBusy(false); } } }); }