package com.jetbrains.python.module;

import com.intellij.ide.util.frameworkSupport.FrameworkSupportProvider;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportUtil;
import com.intellij.ide.util.newProjectWizard.SupportForFrameworksStep;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.module.ModuleTypeManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
import com.jetbrains.python.PythonModuleTypeBase;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yole
 */
public class PythonModuleType extends PythonModuleTypeBase<PythonModuleBuilder> {
  public static PythonModuleType getInstance() {
    return (PythonModuleType)ModuleTypeManager.getInstance().findByID(PYTHON_MODULE);
  }

  @Override
  public ModuleWizardStep[] createWizardSteps(final WizardContext wizardContext,
                                              final PythonModuleBuilder moduleBuilder,
                                              final ModulesProvider modulesProvider) {
    ArrayList<ModuleWizardStep> steps = new ArrayList<ModuleWizardStep>();
    final Project project = getProject(wizardContext);
    steps.add(new PythonSdkSelectStep(moduleBuilder, null, "reference.project.structure.sdk.python", project));
    final List<FrameworkSupportProvider> frameworkSupportProviderList = FrameworkSupportUtil.getProviders(getInstance());
    if (!frameworkSupportProviderList.isEmpty()) {
      steps.add(new SupportForFrameworksStep(moduleBuilder, LibrariesContainerFactory.createContainer(project)));
    }
    return steps.toArray(new ModuleWizardStep[steps.size()]);
  }

  private static Project getProject(final WizardContext context) {
    Project project = context.getProject();
    if (project == null) {
      project = ProjectManager.getInstance().getDefaultProject();
    }
    return project;
  }

  public PythonModuleBuilder createModuleBuilder() {
    return new PythonModuleBuilder();
  }
}

@@ -47,32 +47,77 @@
 om.intellij.
-ide.util
+facet.impl.DefaultFacetsProvider;%0Aimport com.intellij
 .frameworkSu
@@ -106,32 +106,36 @@
 tellij.framework
+.add
 Support.Framewor
@@ -134,32 +134,40 @@
 FrameworkSupport
+InModule
 Provider;%0Aimport
@@ -1609,32 +1609,40 @@
 FrameworkSupport
+InModule
 Provider%3E framew
@@ -1639,36 +1639,17 @@
 er%3E 
-frameworkSupportP
+p
 rovider
-List
+s
  = F
@@ -1698,48 +1698,61 @@
 ce()
-);%0A    if (!frameworkSupportP
+, DefaultFacetsProvider.INSTANCE);%0A    if (!p
 rovider
-List
+s
 .isE

allow to add support for framework from Project Structure dialog (for Groovy, JSF and Spring libraries for now)