void () { final List<InstalledPackage> packages = getSelectedPackages(); final PackageManagementService selPackageManagementService = myPackageManagementService; if (selPackageManagementService != null) { ModalityState modalityState = ModalityState.current(); PackageManagementService.Listener listener = new PackageManagementService.Listener() { @Override public void operationStarted(String packageName) { ApplicationManager.getApplication().invokeLater( () -> myPackagesTable.setPaintBusy(true), modalityState ); } @Override public void operationFinished(final String packageName, @Nullable final PackageManagementService.ErrorDescription errorDescription) { ApplicationManager.getApplication().invokeLater(() -> { myPackagesTable.clearSelection(); updatePackages(selPackageManagementService); myPackagesTable.setPaintBusy(!myCurrentlyInstalling.isEmpty()); if (errorDescription == null) { if (packageName != null) { myNotificationArea.showSuccess(IdeBundle.message("package.successfully.uninstalled", packageName)); } else { myNotificationArea.showSuccess(IdeBundle.message("packages.successfully.uninstalled")); } } else { myNotificationArea.showError(IdeBundle.message("uninstall.packages.failed"), IdeBundle.message("uninstall.packages.failed.dialog.title"), errorDescription); } }, modalityState); } }; myPackageManagementService.uninstallPackages(packages, listener); } }