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
;
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
);
32 public ProjectStructureProblemDescription
.Severity
getSeverity() {
33 if (myProblemDescriptions
== null || myProblemDescriptions
.isEmpty()) {
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();
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();
57 StringBuilderSpinAllocator
.dispose(buf
);
62 public List
<ProjectStructureProblemDescription
> getProblemDescriptions() {
63 return myProblemDescriptions
;