1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.theplugin.idea.ui.tree.comment;
18
19 import com.atlassian.theplugin.commons.crucible.api.model.GeneralComment;
20 import com.atlassian.theplugin.commons.crucible.api.model.ReviewAdapter;
21 import com.atlassian.theplugin.idea.ui.tree.AtlassianClickAction;
22 import com.atlassian.theplugin.idea.ui.tree.AtlassianTreeNode;
23
24
25 public class GeneralCommentTreeNode extends CommentTreeNode {
26 private GeneralComment comment;
27
28 public GeneralCommentTreeNode(ReviewAdapter review, GeneralComment comment, AtlassianClickAction action) {
29 super(action);
30 this.review = review;
31 this.comment = comment;
32 }
33
34 public GeneralCommentTreeNode(final GeneralCommentTreeNode node) {
35 super(node.getAtlassianClickAction());
36 this.review = node.review;
37 this.comment = node.comment;
38 }
39
40 @Override
41 public GeneralComment getComment() {
42 return comment;
43 }
44
45 @Override
46 public AtlassianTreeNode getClone() {
47 return new GeneralCommentTreeNode(this);
48 }
49
50 @Override
51 public int compareTo(Object o) {
52 if (o instanceof GeneralCommentTreeNode) {
53 GeneralCommentTreeNode gctn = (GeneralCommentTreeNode) o;
54 return getComment().getCreateDate().compareTo(gctn.getComment().getCreateDate());
55 }
56 return super.compareTo(o);
57 }
58 }