@Override
  public void uninstallPackages(List<InstalledPackage> installedPackages, final Listener listener) {
    final String packageName =
        installedPackages.size() == 1 ? installedPackages.get(0).getName() : null;
    PyPackageManagerUI ui =
        new PyPackageManagerUI(
            myProject,
            mySdk,
            new PyPackageManagerUI.Listener() {
              @Override
              public void started() {
                listener.operationStarted(packageName);
              }

              @Override
              public void finished(final List<PyExternalProcessException> exceptions) {
                listener.operationFinished(packageName, toErrorDescription(exceptions));
              }
            });

    List<PyPackage> pyPackages = new ArrayList<PyPackage>();
    for (InstalledPackage aPackage : installedPackages) {
      if (aPackage instanceof PyPackage) {
        pyPackages.add((PyPackage) aPackage);
      }
    }
    ui.uninstall(pyPackages);
  }
 private String toErrorDescription(List<PyExternalProcessException> exceptions) {
   String errorDescription = null;
   if (exceptions != null && exceptions.size() > 0) {
     errorDescription = PyPackageManagerUI.createDescription(exceptions, "");
   }
   return errorDescription;
 }