get rid of empty space when a smaller tab selected
[idea/community.git] / platform / lang-impl / src / com / intellij / execution / impl / ConfigurationSettingsEditor.java
index d40bb736a36ce71277d081a96ef2bcdf1f03f360..99cb84c7009783b2483a796694fa308b551d12bf 100644 (file)
@@ -21,6 +21,7 @@ import com.intellij.execution.configurations.ConfigurationPerRunnerSettings;
 import com.intellij.execution.configurations.RunConfiguration;
 import com.intellij.execution.configurations.RunnerSettings;
 import com.intellij.execution.runners.ProgramRunner;
+import com.intellij.execution.ui.AdjustingTabSettingsEditor;
 import com.intellij.openapi.options.*;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.Disposer;
@@ -31,6 +32,8 @@ import com.intellij.ui.ScrollingUtil;
 import com.intellij.ui.SimpleTextAttributes;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.Convertor;
+import com.intellij.util.ui.update.Activatable;
+import com.intellij.util.ui.update.UiNotifyConnector;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
@@ -318,7 +321,36 @@ public class ConfigurationSettingsEditor extends CompositeSettingsEditor<RunnerA
     @Override
     @NotNull
     public JComponent createEditor() {
-      return myConfigEditor.getComponent();
+      JComponent component = myConfigEditor.getComponent();
+      if (myConfigEditor instanceof AdjustingTabSettingsEditor) {
+        JPanel panel = new JPanel(new BorderLayout());
+        UiNotifyConnector connector = new UiNotifyConnector(panel, new Activatable() {
+          private boolean myIsEmpty = true;
+          @Override
+          public void showNotify() {
+            if (myIsEmpty) {
+              panel.add(component, BorderLayout.CENTER);
+              panel.revalidate();
+              panel.repaint();
+              myIsEmpty = false;
+            }
+          }
+
+          @Override
+          public void hideNotify() {
+            if (!myIsEmpty) {
+              panel.removeAll();
+              panel.revalidate();
+              panel.repaint();
+              myIsEmpty = true;
+            }
+          }
+
+        });
+        Disposer.register(this, connector);
+        return panel;
+      }
+      return component;
     }
 
     @Override