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;
}
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);
}
}
Aggregations