Create New Module Programitically
Answered
I am working on a plugin and want to create a Kotlin module programmatically as we have in New Module Action.
override fun actionPerformed(event: AnActionEvent) {
val project = event.getData(PlatformDataKeys.PROJECT) ?: return
val dataContext = event.dataContext
val module = LangDataKeys.MODULE.getData(dataContext) ?: return
runWriteAction {
val moduleManager = ModuleManager.getInstance(project)
val newModule = ModuleManager.getInstance(project).newModule(
project.basePath + "/" + module.name + ".abdul" + ModuleFileType.DOT_DEFAULT_EXTENSION,
ModuleType.EMPTY.id
)
}
}
So this creates a new Module that gets shown in settings but unable to see in the package. Also after that, I have to create different folders like src, main etc and then I have to add files.
Any idea how I can do that.
Please sign in to leave a comment.
Hi Abdul,
Please see:
Thanks, Karol Lewandowski got it. This is how I am doing it, Would love to hear your thoughts on this,