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;
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;
@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
--- /dev/null
+/*
+ * Copyright 2000-2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.execution.ui;
+
+import com.intellij.openapi.options.SettingsEditor;
+
+/**
+ * Marker interface for {@link SettingsEditor} inheritors.
+ * Allows to ignore this {@link SettingsEditor#getComponent()} when showing {@link javax.swing.JTabbedPane}, if tab
+ * represented by this {@code SettingsEditor} instance is not selected.
+ * As a result, no empty space or scrollbars when smaller tab component selected.
+ *
+ * @see {@link com.intellij.openapi.options.SettingsEditorGroup}
+ */
+public interface AdjustingTabSettingsEditor {
+}