Search in sources :

Example 1 with CommentGroup

use of org.eclipse.mylyn.internal.tasks.ui.editors.CommentGroupStrategy.CommentGroup in project linuxtools by eclipse.

the class OSIOWorkitemLinkAttributeEditor method getCommentGroupViewers.

public List<CommentGroupViewer> getCommentGroupViewers() {
    if (commentGroupViewers != null) {
        return commentGroupViewers;
    }
    // group comments
    List<ITaskComment> comments = new ArrayList<ITaskComment>();
    for (TaskAttribute commentAttribute : this.commentAttributes) {
        comments.add(convertToTaskComment(getModel(), commentAttribute));
    }
    String currentPersonId = getModel().getTaskRepository().getUserName();
    List<CommentGroup> commentGroups = getCommentGroupStrategy().groupComments(comments, currentPersonId);
    commentGroupViewers = new ArrayList<CommentGroupViewer>(commentGroups.size());
    if (commentGroups.size() > 0) {
        for (int i = 0; i < commentGroups.size(); i++) {
            CommentGroupViewer viewer = new CommentGroupViewer(commentGroups.get(i));
            boolean isLastGroup = i == commentGroups.size() - 1;
            viewer.setRenderedInSubSection(!isLastGroup);
            commentGroupViewers.add(viewer);
        }
    }
    return commentGroupViewers;
}
Also used : ITaskComment(org.eclipse.mylyn.tasks.core.ITaskComment) TaskAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute) CommentGroup(org.eclipse.mylyn.internal.tasks.ui.editors.CommentGroupStrategy.CommentGroup) ArrayList(java.util.ArrayList) Point(org.eclipse.swt.graphics.Point)

Aggregations

ArrayList (java.util.ArrayList)1 CommentGroup (org.eclipse.mylyn.internal.tasks.ui.editors.CommentGroupStrategy.CommentGroup)1 ITaskComment (org.eclipse.mylyn.tasks.core.ITaskComment)1 TaskAttribute (org.eclipse.mylyn.tasks.core.data.TaskAttribute)1 Point (org.eclipse.swt.graphics.Point)1