Search in sources :

Example 1 with InstalledPackage

use of com.intellij.webcore.packaging.InstalledPackage in project intellij-community by JetBrains.

the class PyPackageManagementService method uninstallPackages.

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

        @Override
        public void started() {
            listener.operationStarted(packageName);
        }

        @Override
        public void finished(List<ExecutionException> exceptions) {
            listener.operationFinished(packageName, toErrorDescription(exceptions, mySdk));
        }
    });
    final List<PyPackage> pyPackages = new ArrayList<>();
    for (InstalledPackage aPackage : installedPackages) {
        if (aPackage instanceof PyPackage) {
            pyPackages.add((PyPackage) aPackage);
        }
    }
    ui.uninstall(pyPackages);
}
Also used : InstalledPackage(com.intellij.webcore.packaging.InstalledPackage) ExecutionException(com.intellij.execution.ExecutionException)

Aggregations

ExecutionException (com.intellij.execution.ExecutionException)1 InstalledPackage (com.intellij.webcore.packaging.InstalledPackage)1