IDEA-251030 Icons are not shown in Database toolwindow popup menu
[idea/community.git] / java / idea-ui / src / com / intellij / openapi / roots / ui / configuration / projectRoot / daemon / ProjectStructureProblemDescription.java
index 3c34dff323421cf3fc37eb690363aa5a84553174..40ce641d3cc31c681a2d28974160179d80e6a3d2 100644 (file)
  */
 package com.intellij.openapi.roots.ui.configuration.projectRoot.daemon;
 
+import com.intellij.openapi.util.NlsContexts.DetailedDescription;
+import com.intellij.openapi.util.NlsSafe;
+import com.intellij.openapi.util.text.HtmlChunk;
 import com.intellij.openapi.util.text.StringUtil;
+import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -24,24 +28,24 @@ import java.util.List;
 public class ProjectStructureProblemDescription {
   public enum ProblemLevel {PROJECT, GLOBAL}
   @NotNull
-  private final String myMessage;
-  private final String myDescription;
+  private final @Nls(capitalization = Nls.Capitalization.Sentence) String myMessage;
+  private final HtmlChunk myDescription;
   private final PlaceInProjectStructure myPlace;
   private final List<? extends ConfigurationErrorQuickFix> myFixes;
   private final ProjectStructureProblemType myProblemType;
   private final ProblemLevel myProblemLevel;
   private final boolean myCanShowPlace;
 
-  public ProjectStructureProblemDescription(@NotNull String message,
-                                            @Nullable String description,
+  public ProjectStructureProblemDescription(@NotNull @Nls(capitalization = Nls.Capitalization.Sentence) String message,
+                                            @Nullable HtmlChunk description,
                                             @NotNull PlaceInProjectStructure place,
                                             @NotNull ProjectStructureProblemType problemType,
                                             @NotNull List<? extends ConfigurationErrorQuickFix> fixes) {
     this(message, description, place, problemType, ProblemLevel.PROJECT, fixes, true);
   }
 
-  public ProjectStructureProblemDescription(@NotNull String message,
-                                            @Nullable String description,
+  public ProjectStructureProblemDescription(@NotNull @Nls(capitalization = Nls.Capitalization.Sentence) String message,
+                                            @Nullable HtmlChunk description,
                                             @NotNull PlaceInProjectStructure place,
                                             @NotNull ProjectStructureProblemType problemType,
                                             @NotNull ProblemLevel level,
@@ -55,24 +59,59 @@ public class ProjectStructureProblemDescription {
     myCanShowPlace = canShowPlace;
   }
 
+  /**
+   * @deprecated use the constructor with {@link HtmlChunk} for description.
+   */
+  @Deprecated
+  public ProjectStructureProblemDescription(@NotNull @Nls(capitalization = Nls.Capitalization.Sentence) String message,
+                                            @Nullable @DetailedDescription String description,
+                                            @NotNull PlaceInProjectStructure place,
+                                            @NotNull ProjectStructureProblemType problemType,
+                                            @NotNull List<? extends ConfigurationErrorQuickFix> fixes) {
+    this(message, description, place, problemType, ProblemLevel.PROJECT, fixes, true);
+  }
+
+  /**
+   * @deprecated use the constructor with {@link HtmlChunk} for description.
+   */
+  @Deprecated
+  public ProjectStructureProblemDescription(@NotNull @Nls(capitalization = Nls.Capitalization.Sentence) String message,
+                                            @Nullable @DetailedDescription String description,
+                                            @NotNull PlaceInProjectStructure place,
+                                            @NotNull ProjectStructureProblemType problemType,
+                                            @NotNull ProblemLevel level,
+                                            @NotNull List<? extends ConfigurationErrorQuickFix> fixes, final boolean canShowPlace) {
+    this(message,
+         description != null ? HtmlChunk.raw(description) : null,
+         place,
+         problemType,
+         level,
+         fixes,
+         canShowPlace);
+  }
+
   public ProblemLevel getProblemLevel() {
     return myProblemLevel;
   }
 
   @NotNull
-  public String getMessage(final boolean includePlace) {
-    if (includePlace && myCanShowPlace) {
-      return myPlace.getContainingElement().getPresentableText() + ": " + StringUtil.decapitalize(myMessage);
-    }
+  public @Nls(capitalization = Nls.Capitalization.Sentence) String getMessage() {
     return myMessage;
   }
 
+  @NotNull
+  public @Nls(capitalization = Nls.Capitalization.Sentence) String getMessage(final boolean includePlace) {
+    if (!includePlace || !myCanShowPlace) return myMessage;
+
+    @NlsSafe final String result = myPlace.getContainingElement().getPresentableText() + ": " + StringUtil.decapitalize(myMessage);
+    return result;
+  }
+
   public boolean canShowPlace() {
     return myCanShowPlace;
   }
 
-  @Nullable
-  public String getDescription() {
+  public HtmlChunk getDescription() {
     return myDescription;
   }