@Override
  public Module commitModule(final @NotNull Project project, ModifiableModuleModel model) {
    if (myProjectMode) {
      final Module[] modules = ModuleManager.getInstance(project).getModules();
      if (modules.length > 0) {
        final Module module = modules[0];
        ApplicationManager.getApplication().runWriteAction(() -> {
          try {
            setupModule(module);
          }
          catch (ConfigurationException e) {
            LOG.error(e);
          }
        });

        StartupManager.getInstance(project).registerStartupActivity(() -> {
          ApplicationManager.getApplication().invokeAndWait(() -> {
            ApplicationManager.getApplication().runWriteAction(() -> {
              try {
                ModifiableModuleModel modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel();
                modifiableModuleModel.renameModule(module, module.getProject().getName());
                modifiableModuleModel.commit();
                fixModuleName(module);
              }
              catch (ModuleWithNameAlreadyExists exists) {
                // do nothing
              }
            });
          });
        });
        return module;
      }
      return null;
    }
    else {
      return super.commitModule(project, model);
    }
  }
@Override
  public Module commitModule(final @NotNull Project project, ModifiableModuleModel model)