javaintellij-ideaintellij-plugin

How to display the SDK list in a JComboBox?


I'm trying to develop an IntelliJ (Java) plugin and I've managed to add a new module type to project wizard like A drop down menu.

As for the next step, I want to provide the option to select the project SDK from a JComboBox like Drop down menu selector and for that I've created a form and bound it to a java class which extends ModuleWizardStep but I cannot figure out how to detect the SDK list and display it in a JComboBox

can someone please point me in the right direction, thanks!


Solution

  • If you want to create your custom module wizard step form and want to have a SDK combobox on it you probably need the JdkComboBox class. It's a combobox with SDK list which you may filter by type. You can view SdkSettingsStep class to figure out how to use JdkComboBox class.

    If you want just to add an SDK choice to existing (default) wizard step you can just override the modifySettingsStep method of your ModuleBuilder implementation:

    @Override
    public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep) {
        return new SdkSettingsStep(settingsStep, this, this::isSuitableSdkType);
    }