2 same modules in New Project/Module Wizard

Hello!

I am trying to create a module group with one module in New Project/Module Wizard, but I am getting 2 same modules in my module group. My createTemplates method looks like this:

public ProjectTemplate[] createTemplates(String group, WizardContext context) {

        return new ProjectTemplate[]{
                new BuilderBasedTemplate(new PerfCakeModuleBuilder()),
        };
    }


It has a ProjectTemplate with just one Template, so why there is another module created in my module group? And how can I get rid of it? Thanks.

0
5 comments

Hello,

Could you please check that your ProjectTemplatesFactory isn't registered twice in plugin.xml (<projectTemplatesFactory/> extension point)?

Sergey

0

Thank you for the answer. In plugin.xml I have:

<extensions defaultExtensionNs="com.intellij">
      <moduleType id="PERFCAKE_MODULE"
                  implementationClass="org.perfcake.idea.module.PerfCakeModuleType"/>
      <projectTemplatesFactory implementation="org.perfcake.idea.module.PerfCakeProjectTemplatesFactory"/>
</extensions>



When I remove projectTemplatesFactory I will have just one module in the Wizard, but in group Other (I want my own group with one module)
When I remove moduleType, Intellij screams there is unknown UnknownModuleType.

I think that there is some default module created. I have just implemented ModuleType, JavaModuleBuilder and ProjectTemplateFactory class. Also when I add ModuleBuilder in plugin.xml then it shows even another module in the Wizard (so 3 same modules together).

How it should look like to have just 1 module in my own category in the wizard?

0

Hey, I too tried out what you have mentioned above, and got the same output. The Module gets repeated twice in the group. Well, then I removed the "projectTemplatesFactory" from plugin.xml and instead added another ModuleBuilder.

  <extensions defaultExtensionNs="com.intellij">
    <moduleBuilder id="pluginnewmodule.modulebuilder.one" builderClass="OneModuleBuilder" />
    <moduleBuilder id="pluginnewmodule.modulebuilder.two" builderClass="TwoModuleBuilder" />
    <!--<projectTemplatesFactory implementation="OneTemplateFactory" id="pluginnewmodule.templatefactory.one" />-->
  </extensions>


And I overrided the getGroupName() in both of them.

@Override

    public String getGroupName() {

        return "Game";

    }


And now, I get both the builders in a group "Game". So, instead of one module getting repeated twice, I have two unique modules with different wizard settings. [This is kind of what I was looking for in the first place].

So, I guess that, in Intellij IDEA, you need to have two or more module type to have a Group... If anyone could provide clarity on this one, it would be really helpful.

0

Look at com.intellij.ide.projectWizard.ProjectTypeStep#fillTemplatesMap()
This is where the groups are computed.

0

Old post, but there isn't much information available.  I wanted to use ProjectTemplatesFactory instead of registering multiple ModuleBuilders. So what worked for me to have only one module in the wizard, was that I added to my ModuleBuilder

 
@Override
protected boolean isAvailable() {
  return false;
}

because com.intellij.ide.util.projectWizard.ModuleBuilder#getAllBuilders uses only these where it's true.

0

Please sign in to leave a comment.