Search code examples
intellij-ideaintellij-plugin

How to remove Startup/Configuration tab from Intellij Plugin extending RunConfigurationBase


I am creating a custom IntelliJ plugin (following the IntelliJ tutorial) that implements a custom Run Configuration. My plugin will "run" the contents the open file in the editor on a remote server and display the result in IntelliJ (sort of a script playground). I used the IntelliJ GUI Designer to create the form and it shows up in the Edit Run Configuration, however it shows up under 2 tabs (Configuration and Startup/Configuration) .. neither of which I explicitly define, I assume they come from my extending of RunConfigurationBase?.

public class RunConfigurationImpl extends RunConfigurationBase {

    public RunConfigurationImpl(Project project, ConfigurationFactory factory, String name) {
        super(project, factory, name);
    }

    @NotNull
    @Override
    public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
        return new SettingsEditorImpl();
    }

    @Nullable
    @Override
    public SettingsEditor<ConfigurationPerRunnerSettings> getRunnerSettingsEditor(ProgramRunner runner) {
        return null;
    }

    @Override
    public void checkConfiguration() throws RuntimeConfigurationException {
    }

    @Nullable
    @Override
    public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) throws ExecutionException {
        return null;
    }
}

The first tab is fine (Configuration) .. enter image description here

However I do not want to list the same fields again on the Startup/Connection tab, in fact, I'm happy to just do away with this tab -- or really, I don't care which tab I get rid off, I just want the fields to show once.

Any pointers on how to get rid of this tab?

enter image description here


Solution

  • This is a consolidation of Vassiliy's answer and ensuing comments.

    In order to remove the Startup/Connection tab in the custom Run Configuration UI, ensure that null is being returned from the methods getRunnerSettingsEditor() custom the classes that extends com.intellij.execution.configurations.RunConfiguration and com.intellij.execution.runners.ProgramRunner

    By default the API abstract classes return null for these methods, so make sure you are not overriding them.