Valdating slected Project SDK version on the first wizard page
I'm implementing a new project wizard for a framework. After clicking Next on the initial Wizard dialog, I'd like to validate that the selected SDK meets the minimum version requirement prior to proceeding to the next step, (which is my first custom step). I've overridden validate() in the ModuleWizardStep I am returning via the getCustomOptionsStep(). However, when the validate() method is called on my customOptionsStep class, wizardContext.getProjectJdk() is returning null because the validation is called prior to the chooseTemplateStep setting the selected SDK on the wizardContext. So it appears I need to read the value set in the "Project SDK" dropdown list directly.
How can I access the selected Project SDK from my customOptionsStep's validate method? Or is there a listener I can implement to track what it was last set to so I can validate it?
As a work around, I'm validating it in the next step after it has been set on the wizardContext. But this is leading to a bad UX as I have to say "use the Previous button to go back and change the selected Java version".
Please sign in to leave a comment.
Please see com.jetbrains.python.module.PythonModuleBuilder#modifyProjectTypeStep and implement your logic in com.intellij.ide.util.projectWizard.SdkSettingsStep#onSdkSelected