Search in sources :

Example 6 with ProjectStructureDetector

use of com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector in project intellij-community by JetBrains.

the class DetectedRootData method addRoot.

public DetectedProjectRoot addRoot(ProjectStructureDetector detector, DetectedProjectRoot root) {
    for (Map.Entry<DetectedProjectRoot, Collection<ProjectStructureDetector>> entry : myRoots.entrySet()) {
        final DetectedProjectRoot oldRoot = entry.getKey();
        final DetectedProjectRoot combined = oldRoot.combineWith(root);
        if (combined != null) {
            myRoots.remove(oldRoot);
            final Set<ProjectStructureDetector> values = new HashSet<>(entry.getValue());
            values.add(detector);
            myRoots.put(combined, values);
            if (mySelectedRoot == oldRoot) {
                mySelectedRoot = combined;
            }
            return combined;
        }
    }
    myRoots.putValue(root, detector);
    return root;
}
Also used : DetectedProjectRoot(com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot) ProjectStructureDetector(com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector) MultiMap(com.intellij.util.containers.MultiMap)

Example 7 with ProjectStructureDetector

use of com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector 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

ProjectStructureDetector (com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector)7 DetectedProjectRoot (com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot)5 ModuleDescriptor (com.intellij.ide.util.importProject.ModuleDescriptor)2 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)2 DetectedSourceRoot (com.intellij.ide.util.projectWizard.importSources.DetectedSourceRoot)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 DetectedRootData (com.intellij.ide.util.importProject.DetectedRootData)1 FrameworkDetectionStep (com.intellij.ide.util.importProject.FrameworkDetectionStep)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 AbstractStepWithProgress (com.intellij.ide.util.projectWizard.AbstractStepWithProgress)1 DetectedContentRoot (com.intellij.ide.util.projectWizard.importSources.DetectedContentRoot)1 ProjectFromSourcesBuilderImpl (com.intellij.ide.util.projectWizard.importSources.impl.ProjectFromSourcesBuilderImpl)1 ModuleType (com.intellij.openapi.module.ModuleType)1 SmartList (com.intellij.util.SmartList)1 MultiMap (com.intellij.util.containers.MultiMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1