void (@Nullable final Sdk selectedSdk) { if (selectedSdk == null) { myNotificationArea.hide(); return; } final Application application = ApplicationManager.getApplication(); application.executeOnPooledThread(() -> { PyExecutionException exception = null; try { myHasManagement = PyPackageManager.getInstance(selectedSdk).hasManagement(); application.invokeLater(() -> updateUninstallUpgrade(), ModalityState.any()); if (!myHasManagement) { throw new PyExecutionException(PySdkBundle.message("python.sdk.packaging.tools.not.found"), "pip", Collections.emptyList(), "", "", 0, ImmutableList.of(new PyInstallPackageManagementFix())); } } catch (PyExecutionException e) { exception = e; } catch (ExecutionException e) { return; } final PyExecutionException problem = exception; application.invokeLater(() -> { if (selectedSdk == getSelectedSdk()) { myNotificationArea.hide(); if (problem != null) { final boolean invalid = !PySdkExtKt.getSdkSeemsValid(selectedSdk); if (!invalid) { HtmlBuilder builder = new HtmlBuilder(); builder.append(problem.getMessage()).append(". "); for (final PyExecutionFix fix : problem.getFixes()) { String key = "id" + fix.hashCode(); builder.appendLink(key, fix.getName()); builder.append(" "); myNotificationArea.addLinkHandler(key, () -> { final Sdk sdk = getSelectedSdk(); if (sdk != null) { fix.run(sdk); myNotificationArea.removeLinkHandler(key); updatePackages(PyPackageManagers.getInstance().getManagementService(myProject, sdk)); updateNotifications(sdk); } }); } myNotificationArea.showWarning(builder.toString()); } myInstallButton.setEnabled(!invalid && installEnabled()); } } }, ModalityState.any()); }); }