IDEADEV-41116: exploded war artefact: add warning for dependent module
[fedora-idea.git] / java / idea-ui / src / com / intellij / openapi / roots / ui / configuration / projectRoot / daemon / ProjectStructureProblemsHolderImpl.java
blob60cc936ced237a45468a6afce0dadabe1d2bf28b
1 package com.intellij.openapi.roots.ui.configuration.projectRoot.daemon;
3 import com.intellij.util.SmartList;
4 import com.intellij.util.StringBuilderSpinAllocator;
5 import org.jetbrains.annotations.NotNull;
6 import org.jetbrains.annotations.Nullable;
8 import java.util.List;
10 /**
11 * @author nik
13 public class ProjectStructureProblemsHolderImpl implements ProjectStructureProblemsHolder {
14 private List<ProjectStructureProblemDescription> myProblemDescriptions;
16 public void registerError(@NotNull String message) {
17 registerProblem(new ProjectStructureProblemDescription(message, ProjectStructureProblemDescription.Severity.ERROR));
20 public void registerWarning(@NotNull String message) {
21 registerProblem(new ProjectStructureProblemDescription(message, ProjectStructureProblemDescription.Severity.WARNING));
24 public void registerProblem(final @NotNull ProjectStructureProblemDescription description) {
25 if (myProblemDescriptions == null) {
26 myProblemDescriptions = new SmartList<ProjectStructureProblemDescription>();
28 myProblemDescriptions.add(description);
31 @Nullable
32 public ProjectStructureProblemDescription.Severity getSeverity() {
33 if (myProblemDescriptions == null || myProblemDescriptions.isEmpty()) {
34 return null;
36 for (ProjectStructureProblemDescription description : myProblemDescriptions) {
37 if (description.getSeverity() == ProjectStructureProblemDescription.Severity.ERROR) {
38 return ProjectStructureProblemDescription.Severity.ERROR;
41 return ProjectStructureProblemDescription.Severity.WARNING;
44 public String composeTooltipMessage() {
45 final StringBuilder buf = StringBuilderSpinAllocator.alloc();
46 try {
47 buf.append("<html><body>");
48 if (myProblemDescriptions != null) {
49 for (ProjectStructureProblemDescription problemDescription : myProblemDescriptions) {
50 buf.append(problemDescription.getMessage()).append("<br>");
53 buf.append("</body></html>");
54 return buf.toString();
56 finally {
57 StringBuilderSpinAllocator.dispose(buf);
61 @Nullable
62 public List<ProjectStructureProblemDescription> getProblemDescriptions() {
63 return myProblemDescriptions;