use of com.intellij.compiler.ModuleSourceSet in project intellij-community by JetBrains.
the class GeneralProjectSettingsElement method check.
@Override
public void check(ProjectStructureProblemsHolder problemsHolder) {
final Project project = myContext.getProject();
if (containsModuleWithInheritedSdk()) {
ProjectSdksModel model = ProjectStructureConfigurable.getInstance(project).getProjectJdksModel();
Sdk sdk = model.getProjectSdk();
if (sdk == null) {
PlaceInProjectStructureBase place = new PlaceInProjectStructureBase(project, ProjectStructureConfigurable.getInstance(project).createProjectConfigurablePlace(), this);
problemsHolder.registerProblem(ProjectBundle.message("project.roots.project.jdk.problem.message"), null, ProjectStructureProblemType.error("project-sdk-not-defined"), place, null);
}
}
List<Chunk<ModuleSourceSet>> sourceSetCycles = ModuleCompilerUtil.computeSourceSetCycles(myContext.getModulesConfigurator());
List<String> cycles = new ArrayList<>();
for (Chunk<ModuleSourceSet> chunk : sourceSetCycles) {
final Set<ModuleSourceSet> sourceSets = chunk.getNodes();
List<String> names = new ArrayList<>();
for (ModuleSourceSet sourceSet : sourceSets) {
String name = sourceSet.getDisplayName();
names.add(names.isEmpty() ? name : StringUtil.decapitalize(name));
}
cycles.add(StringUtil.join(names, ", "));
}
if (!cycles.isEmpty()) {
final PlaceInProjectStructureBase place = new PlaceInProjectStructureBase(project, ProjectStructureConfigurable.getInstance(project).createModulesPlace(), this);
final String message;
final String description;
if (cycles.size() > 1) {
message = "Circular dependencies";
@NonNls final String br = "<br> ";
StringBuilder cyclesString = new StringBuilder();
for (int i = 0; i < cycles.size(); i++) {
cyclesString.append(br).append(i + 1).append(". ").append(cycles.get(i));
}
description = ProjectBundle.message("module.circular.dependency.warning.description", cyclesString);
} else {
message = ProjectBundle.message("module.circular.dependency.warning.short", StringUtil.decapitalize(cycles.get(0)));
description = null;
}
problemsHolder.registerProblem(new ProjectStructureProblemDescription(message, description, place, ProjectStructureProblemType.warning("module-circular-dependency"), Collections.<ConfigurationErrorQuickFix>emptyList()));
}
}
Aggregations