01: package tide.staticanalysis;
02:
03: import java.awt.Color;
04: import snow.utils.storage.StorageVector;
05: import tide.editor.linemessages.LineMessage;
06:
07: public final class TintLineMessage extends LineMessage {
08: private final String mess, shortMess;
09: private final String category;
10: private final int priority;
11:
12: TintLineMessage(final String javaName, final String mess,
13: final String category, int line, long created, int priority) {
14: super (javaName, line, created);
15: this .mess = mess;
16: this .shortMess = mess; // no: SyntaxUtils.makeAllJavaNamesSimpleInText(mess);
17: this .category = category;
18: this .priority = priority;
19: }
20:
21: @Override
22: public String getMessage() {
23: return mess;
24: }
25:
26: @Override
27: public String getCategory() {
28: return category;
29: }
30:
31: @Override
32: public int getPriority() {
33: return priority;
34: }
35:
36: @Override
37: public String getMessageForTableColumn() {
38: return shortMess;
39: }
40:
41: @Override
42: public String toStringHTML() {
43: return "Tlint: " + shortMess;
44: }
45:
46: @Override
47: public Color getColor() {
48: return Color.green;
49: }
50:
51: @Override
52: public String getLetter() {
53: return "T";
54: } // null for a point
55:
56: @Override
57: public int getShiftX() {
58: return 4;
59: }
60:
61: @Override
62: public String getMessageOriginator() {
63: return "TLint";
64: }
65:
66: @Override
67: public StorageVector getStorageRepresentation() {
68: StorageVector sv = new StorageVector();
69: sv.add(1);
70: sv.add("TintLineMessage");
71: sv.add(javaName);
72: sv.add(mess);
73: sv.add(category);
74: sv.add(line);
75: sv.add(created);
76: sv.add(priority);
77: return sv;
78: }
79:
80: public static TintLineMessage createFromStorageVector(
81: StorageVector sv) {
82: int priority = 1;
83: if (sv.size() > 7)
84: priority = (Integer) sv.get(7);
85: return new TintLineMessage((String) sv.get(2), (String) sv
86: .get(3), (String) sv.get(4), (Integer) sv.get(5),
87: (Long) sv.get(6), priority);
88: }
89: }
|