How do I create a SDK selector ComboBox in an IntelliJ plugin?

Answered

I'm trying to include an SDK/JDK selector in one of my custom module wizard creator steps. Here is an example of IntelliJs: IntelliJ SDK selector

I have seen this in another plugin so I know its possible to replicate. The docs are honestly so bad and everything is outdated in this regard.

I found a post on the IntelliJ forums which said to try this:

ProjectSdksModel model = new ProjectSdksModel();
model.reset(project);
JdkComboBox jdkComboBox = new JdkComboBox(model, null);

The OP claims it worked, but I have no access to the JdkComboBox module which makes things very difficult. (I'm not sure why).

If anyone has any guidance on how I can replicate this module, or even provide any code, I'd be super grateful.

1 comment
Comment actions Permalink

Hi Stephen,

Did you define a dependency on the Java plugin? Here is the instruction on how to do it:
https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html

Once you add it in the Gradle build script and plugin.xml, JdkComboBox should be accessible in your project.

0

Please sign in to leave a comment.