Search in sources :

Example 1 with DetectedRootData

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

the class ImportFromSourcesTestCase method importFromSources.

protected void importFromSources(File dir) {
    myRootDir = dir;
    try {
        myProject = doCreateProject(getIprFile());
        myBuilder.setBaseProjectPath(dir.getAbsolutePath());
        List<DetectedRootData> list = RootDetectionProcessor.detectRoots(dir);
        MultiMap<ProjectStructureDetector, DetectedProjectRoot> map = RootDetectionProcessor.createRootsMap(list);
        myBuilder.setupProjectStructure(map);
        for (ProjectStructureDetector detector : map.keySet()) {
            List<ModuleWizardStep> steps = detector.createWizardSteps(myBuilder, myBuilder.getProjectDescriptor(detector), EmptyIcon.ICON_16);
            try {
                for (ModuleWizardStep step : steps) {
                    if (step instanceof AbstractStepWithProgress<?>) {
                        performStep((AbstractStepWithProgress<?>) step);
                    }
                }
            } finally {
                for (ModuleWizardStep step : steps) {
                    step.disposeUIResources();
                }
            }
        }
        myBuilder.commit(myProject, null, ModulesProvider.EMPTY_MODULES_PROVIDER);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : DetectedProjectRoot(com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot) AbstractStepWithProgress(com.intellij.ide.util.projectWizard.AbstractStepWithProgress) DetectedRootData(com.intellij.ide.util.importProject.DetectedRootData) ProjectStructureDetector(com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep)

Aggregations

DetectedRootData (com.intellij.ide.util.importProject.DetectedRootData)1 AbstractStepWithProgress (com.intellij.ide.util.projectWizard.AbstractStepWithProgress)1 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)1 DetectedProjectRoot (com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot)1 ProjectStructureDetector (com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector)1