Don't add the same tabs twice (PY-21270)
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 11 Jan 2017 16:04:02 +0000 (17:04 +0100)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 11 Jan 2017 16:05:12 +0000 (17:05 +0100)
java/idea-ui/src/com/intellij/openapi/projectRoots/ui/SdkEditor.java

index d7dd3efc7cdf1a24a84ea68804d9b541d7a8c3fe..6c2687978febbaa4c309708d548f65ef466f75e5 100644 (file)
@@ -372,6 +372,11 @@ public class SdkEditor implements Configurable, Place.Navigator {
       }
       if (component != null) {
         if (configurable.getTabName() != null) {
+          for (int i = 0; i < myTabbedPane.getTabCount(); i++) {
+            if (configurable.getTabName().equals(myTabbedPane.getTitleAt(i))) {
+              myTabbedPane.removeTabAt(i);
+            }
+          }
           myTabbedPane.addTab(configurable.getTabName(), component);
         }
         else {