mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
delegate to comment for formatting
This commit is contained in:
@@ -34,4 +34,15 @@ public abstract class Comment {
|
||||
|
||||
@Nullable
|
||||
public abstract Date getDate();
|
||||
|
||||
public void appendTo(StringBuilder builder) {
|
||||
builder.append("<hr>");
|
||||
if (getAuthor() != null) {
|
||||
builder.append("<b>Author:</b> ").append(getAuthor()).append("<br>");
|
||||
}
|
||||
if (getDate() != null) {
|
||||
builder.append("<b>Date:</b> ").append(getDate()).append("<br>");
|
||||
}
|
||||
builder.append(getText()).append("<br>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,23 +59,12 @@ public class TaskDocumentationProvider extends AbstractDocumentationProvider imp
|
||||
builder.append("<b>Description:</b><br>").append(task.getDescription());
|
||||
}
|
||||
for (Comment comment : task.getComments()) {
|
||||
addComment(builder, comment);
|
||||
comment.appendTo(builder);
|
||||
}
|
||||
builder.append("</html>");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private static void addComment(final StringBuilder builder, final Comment comment) {
|
||||
builder.append("<hr>");
|
||||
if (comment.getAuthor() != null) {
|
||||
builder.append("<b>Author:</b> ").append(comment.getAuthor()).append("<br>");
|
||||
}
|
||||
if (comment.getDate() != null) {
|
||||
builder.append("<b>Date:</b> ").append(comment.getDate()).append("<br>");
|
||||
}
|
||||
builder.append(comment.getText()).append("<br>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) {
|
||||
return object instanceof Task ? new TaskPsiElement(psiManager, (Task)object): null;
|
||||
|
||||
Reference in New Issue
Block a user