Search in sources :

Example 1 with RootsDetectionStep

use of com.intellij.ide.util.importProject.RootsDetectionStep in project intellij-community by JetBrains.

the class CreateFromSourcesMode method addSteps.

public void addSteps(WizardContext context, ModulesProvider modulesProvider, StepSequence sequence, String specific) {
    final ProjectFromSourcesBuilderImpl projectBuilder = new ProjectFromSourcesBuilderImpl(context, modulesProvider);
    myProjectBuilder = projectBuilder;
    final Icon icon = context.getStepIcon();
    if (context.isCreatingNewProject()) {
        addStep(sequence, new ProjectNameStep(context, this), specific);
    }
    addStep(sequence, new RootsDetectionStep(projectBuilder, context, sequence, icon, "reference.dialogs.new.project.fromCode.source"), specific);
    Set<String> detectorTypes = new HashSet<>();
    for (ProjectStructureDetector detector : ProjectStructureDetector.EP_NAME.getExtensions()) {
        detectorTypes.add(detector.getDetectorId());
        for (ModuleWizardStep step : detector.createWizardSteps(projectBuilder, projectBuilder.getProjectDescriptor(detector), icon)) {
            sequence.addSpecificStep(detector.getDetectorId(), step);
        }
    }
    if (FrameworkDetectionStep.isEnabled()) {
        FrameworkDetectionStep frameworkDetectionStep = new FrameworkDetectionStep(icon, projectBuilder) {

            public List<ModuleDescriptor> getModuleDescriptors() {
                final List<ModuleDescriptor> moduleDescriptors = new ArrayList<>();
                for (ProjectDescriptor descriptor : projectBuilder.getSelectedDescriptors()) {
                    moduleDescriptors.addAll(descriptor.getModules());
                }
                return moduleDescriptors;
            }
        };
        projectBuilder.addConfigurationUpdater(frameworkDetectionStep);
        sequence.addCommonFinishingStep(frameworkDetectionStep, detectorTypes);
    }
}
Also used : ArrayList(java.util.ArrayList) ProjectFromSourcesBuilderImpl(com.intellij.ide.util.projectWizard.importSources.impl.ProjectFromSourcesBuilderImpl) ModuleDescriptor(com.intellij.ide.util.importProject.ModuleDescriptor) ProjectStructureDetector(com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) ProjectNameStep(com.intellij.ide.util.newProjectWizard.ProjectNameStep) ProjectDescriptor(com.intellij.ide.util.importProject.ProjectDescriptor) FrameworkDetectionStep(com.intellij.ide.util.importProject.FrameworkDetectionStep) RootsDetectionStep(com.intellij.ide.util.importProject.RootsDetectionStep) HashSet(java.util.HashSet)

Aggregations

FrameworkDetectionStep (com.intellij.ide.util.importProject.FrameworkDetectionStep)1 ModuleDescriptor (com.intellij.ide.util.importProject.ModuleDescriptor)1 ProjectDescriptor (com.intellij.ide.util.importProject.ProjectDescriptor)1 RootsDetectionStep (com.intellij.ide.util.importProject.RootsDetectionStep)1 ProjectNameStep (com.intellij.ide.util.newProjectWizard.ProjectNameStep)1 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)1 ProjectStructureDetector (com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector)1 ProjectFromSourcesBuilderImpl (com.intellij.ide.util.projectWizard.importSources.impl.ProjectFromSourcesBuilderImpl)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1