1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.theplugin.idea.crucible;
18
19
20 import com.atlassian.theplugin.commons.crucible.api.model.GeneralComment;
21
22 import javax.swing.tree.DefaultMutableTreeNode;
23
24
25
26
27
28
29
30
31 public class CommentNode extends DefaultMutableTreeNode {
32 private GeneralComment generalComment;
33
34 private static final int BEGIN_INDEX = 10;
35
36 public CommentNode(GeneralComment aGeneralComment) {
37 this.generalComment = aGeneralComment;
38 }
39
40
41
42 public GeneralComment getGeneralComment() {
43 return generalComment;
44 }
45
46 public void setGeneralComment(GeneralComment generalComment) {
47 this.generalComment = generalComment;
48 }
49
50 public String toString() {
51 return generalComment.getMessage().substring(BEGIN_INDEX) + "(" + generalComment.getAuthor() + ")";
52 }
53
54 public boolean equals(Object o) {
55 if (this == o) {
56 return true;
57 }
58 if (o == null || getClass() != o.getClass()) {
59 return false;
60 }
61
62 CommentNode that = (CommentNode) o;
63
64 if (!generalComment.equals(that.generalComment)) {
65 return false;
66 }
67
68 return true;
69 }
70
71 public int hashCode() {
72 return generalComment.hashCode();
73 }
74 }
75