Hi!
I have my own new project wizard extending GeneratorNewProjectWizard. To have it available in New Project dialog without additional steps I have wrapped it in GeneratorNewProjectWizardBuilderAdapter.
As it is not working well for New Module wizard, I’m distinguishing New Project from New Module using:
override fun isAvailable(): Boolean {
val lastPerformedActionId = (ActionManager.getInstance() as ActionManagerImpl).lastPreformedActionId
lastPerformedActionId ?: return false
return lastPerformedActionId.contains("NewProject", true)
}
ActionManagerImpl has been marked in 252 as @ApiStatus.Internal.
What is valid way to display my wizard in New Project and not in New Module?
BTW: I cannot create topic with GeneratorNewProjectWizardBuilderAdapter as it is too long single word :-C
As no answer received, I came up with workaround below (better than nothing):
// Show wizard only for new projects, not modules
override fun isAvailable(): Boolean {
return Thread.currentThread().stackTrace.none { element ->
element.className.equals(NewModuleAction::class.java.name)
}
}
Correct me if there is better solution. Thanks
If found WizardContext.isCreatingNewProject for createStep but not for isEnabled
Yes, please do not use ActionManagerImpl it may disappear and break any time
Yes, I found that flag but createStep is not called when using NewProject / NewModule action 
Hi Marcin,
Unfortunately, we can’t safely check in which context the NPW generator is available.
As a workaround, our users check a stack trace.
private fun isCreateNewProjectFlow(): Boolean {
return Thread.currentThread().stackTrace.any { element →
element.className.contains(NewProjectAction::class.java.name)
}
}
Could you please follow the corresponding issue in YouTrack?
IJPL-188050 Provide ‘ModuleBuilder#isAvailable’ access to ‘WizardContext’