Show New Module dialog
Hi all,
my apologies if this question has been asked before, but I could not find a solution.
I have some UI in my plugin that lets the user add a new Module to the project by clicking a button. The modules all belong to one specific Module Type. I would like to use IntelliJ's standard New Module dialog for this purpose. However, I have not found a way in the API to do this. Therefore I would like to ask:
* Is it possible to invoke the New Module dialog from the plugin?
* If so, can I restrict what Module Types are available when invoking the dialog from my button?
Thanks, everyone, in advance.
Cheers
-JP
EDIT:
After some prodding, I believe I figured out what I need to do. I want to use a NewProjectWizard and get a ProjectBuilder from it to create a new Module. The resulting code looks a little something like this
AbstractProjectWizard wizard = new NewProjectWizard(
myProject,
myParentComponent,
ModulesProvider.EMPTY_MODULES_PROVIDER,
myDefaultModuleName );
if (wizard.showAndGet()) {
ProjectBuilder builder = wizard.getBuilder(myProject);
if (builder != null) {
builder.commit(myProject);
}
}
I wasn't sure where to get a ModulesProvider Object from, but ModulesProvider.EMPTY_MODULES_PROVIDER seems to do the trick. I am also still not sure how to customize the Wizard's behaviour short of extending the class.
Please sign in to leave a comment.