IDEA-134883 (condition fixed)
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Thu, 15 Jan 2015 20:04:02 +0000 (21:04 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Thu, 15 Jan 2015 20:04:02 +0000 (21:04 +0100)
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginUpdateInfoDialog.java

index ab2fd59362d0de271ce1468c3f9ab90ba7435374..43d64d5feb35690ee3ad4a40c0984ce2b1fef473 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,12 +22,15 @@ import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.progress.Task;
+import com.intellij.openapi.util.Condition;
 import com.intellij.ui.TableUtil;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 import java.awt.*;
 import java.util.Collection;
+import java.util.Set;
 
 /**
  * @author pti
@@ -106,8 +109,14 @@ class PluginUpdateInfoDialog extends AbstractUpdateDialog {
       foundPluginsPanel.addStateListener(new DetectedPluginsPanel.Listener() {
         @Override
         public void stateChanged() {
-          boolean allSkipped = foundPluginsPanel.getSkippedPlugins().size() == myUploadedPlugins.size();
-          getOKAction().setEnabled(!allSkipped);
+          final Set<String> skipped = foundPluginsPanel.getSkippedPlugins();
+          final PluginDownloader any = ContainerUtil.find(myUploadedPlugins, new Condition<PluginDownloader>() {
+            @Override
+            public boolean value(PluginDownloader plugin) {
+              return !skipped.contains(plugin.getPluginId());
+            }
+          });
+          getOKAction().setEnabled(any != null);
         }
       });
       myPluginsPanel.add(foundPluginsPanel, BorderLayout.CENTER);