@Override
      public void consume(List<String> releases) {
        if (!releases.isEmpty() && !isUpdateAvailable(pkg.getVersion(), releases.get(0))) {
          return;
        }

        ApplicationManager.getApplication().invokeLater(() -> {
          ModalityState modalityState = ModalityState.current();
          final PackageManagementService.Listener listener = new PackageManagementService.Listener() {
            @Override
            public void operationStarted(final String packageName) {
              ApplicationManager.getApplication().invokeLater(() -> {
                myPackagesTable.setPaintBusy(true);
                myCurrentlyInstalling.add(packageName);
              }, modalityState);
            }

            @Override
            public void operationFinished(final String packageName,
                                          @Nullable final PackageManagementService.ErrorDescription errorDescription) {
              ApplicationManager.getApplication().invokeLater(() -> {
                myPackagesTable.clearSelection();
                updatePackages(selPackageManagementService);
                myCurrentlyInstalling.remove(packageName);
                myPackagesTable.setPaintBusy(!myCurrentlyInstalling.isEmpty());
                if (errorDescription == null) {
                  myNotificationArea.showSuccess(IdeBundle.message("package.successfully.upgraded", packageName));
                }
                else {
                  myNotificationArea.showError(IdeBundle.message("upgrade.packages.failed"),
                                               IdeBundle.message("upgrade.packages.failed.dialog.title"),
                                               errorDescription);
                }

                if (myCurrentlyInstalling.isEmpty() && !myWaitingToUpgrade.isEmpty()) {
                  upgradePostponedPackages();
                }
              }, modalityState);
            }
          };
          PackageManagementServiceEx serviceEx = getServiceEx();
          if (serviceEx != null) {
            serviceEx.updatePackage(pkg, toVersion, listener);
          }
          else {
            myPackageManagementService.installPackage(new RepoPackage(pkg.getName(), null /* TODO? */), null, true, null, listener, false);
          }
          myUpgradeEnabled = false;
        }, ModalityState.any());
      }
@Override
      public void consume(List<String> releases)