Custom ModuleBuilder only for new projects, not modules


I would like to create a custom project generator that shows up in the “New Project” dialog window. However, I do not want this generator in the “New Module” window.

To achieve this, I have created a custom ModuleType and a corresponding ModuleBuilder, and then added the ModuleType to plugin.xml. Unsurprisingly, the custom project generator shows up in both “New Project” and “New Module” windows. What should I do to make the project generator hidden from the “New Module” window?

I am aware of the `ModuleBuilder.isAvailable` method, and I can return false to hide the generator. However, I don't know how to distinguish between creating a project vs. a module in the context of `isAvailable`.

public boolean isAvailable() {
    return false; // This would hide the generator from both "New Project" and "New Module" dialog windows. I want to hide it solely from the "New Module" window.

If relevant, here's the current implementation:

Thanks in advance