Lines 62-67
Link Here
|
62 |
public class ParseErrorAnnotation extends Annotation implements PropertyChangeListener { |
62 |
public class ParseErrorAnnotation extends Annotation implements PropertyChangeListener { |
63 |
|
63 |
|
64 |
private final Severity severity; |
64 |
private final Severity severity; |
|
|
65 |
private final String customType; |
65 |
private final FixData fixes; |
66 |
private final FixData fixes; |
66 |
private final String description; |
67 |
private final String description; |
67 |
private final String shortDescription; |
68 |
private final String shortDescription; |
Lines 71-76
Link Here
|
71 |
/** Creates a new instance of ParseErrorAnnotation */ |
72 |
/** Creates a new instance of ParseErrorAnnotation */ |
72 |
public ParseErrorAnnotation(Severity severity, FixData fixes, String description, Position lineStart, AnnotationHolder holder) { |
73 |
public ParseErrorAnnotation(Severity severity, FixData fixes, String description, Position lineStart, AnnotationHolder holder) { |
73 |
this.severity = severity; |
74 |
this.severity = severity; |
|
|
75 |
this.customType = null; |
76 |
this.fixes = fixes; |
77 |
this.description = description; |
78 |
this.shortDescription = description + NbBundle.getMessage(ParseErrorAnnotation.class, "LBL_shortcut_promotion"); //NOI18N |
79 |
this.lineStart = lineStart; |
80 |
this.holder = holder; |
81 |
|
82 |
if (!fixes.isComputed()) { |
83 |
fixes.addPropertyChangeListener(WeakListeners.propertyChange(this, fixes)); |
84 |
} |
85 |
} |
86 |
|
87 |
public ParseErrorAnnotation(Severity severity, String customType, FixData fixes, String description, Position lineStart, AnnotationHolder holder) { |
88 |
this.severity = severity; |
89 |
this.customType = customType; |
74 |
this.fixes = fixes; |
90 |
this.fixes = fixes; |
75 |
this.description = description; |
91 |
this.description = description; |
76 |
this.shortDescription = description + NbBundle.getMessage(ParseErrorAnnotation.class, "LBL_shortcut_promotion"); //NOI18N |
92 |
this.shortDescription = description + NbBundle.getMessage(ParseErrorAnnotation.class, "LBL_shortcut_promotion"); //NOI18N |
Lines 85-114
Link Here
|
85 |
public String getAnnotationType() { |
101 |
public String getAnnotationType() { |
86 |
boolean hasFixes = fixes.isComputed() && !fixes.getFixes().isEmpty(); |
102 |
boolean hasFixes = fixes.isComputed() && !fixes.getFixes().isEmpty(); |
87 |
|
103 |
|
88 |
switch (severity) { |
104 |
if (customType == null) { |
89 |
case ERROR: |
105 |
switch (severity) { |
90 |
if (hasFixes) |
106 |
case ERROR: |
91 |
return "org-netbeans-spi-editor-hints-parser_annotation_err_fixable"; |
107 |
if (hasFixes) |
92 |
else |
108 |
return "org-netbeans-spi-editor-hints-parser_annotation_err_fixable"; |
93 |
return "org-netbeans-spi-editor-hints-parser_annotation_err"; |
109 |
else |
94 |
|
110 |
return "org-netbeans-spi-editor-hints-parser_annotation_err"; |
95 |
case WARNING: |
111 |
|
96 |
if (hasFixes) |
112 |
case WARNING: |
97 |
return "org-netbeans-spi-editor-hints-parser_annotation_warn_fixable"; |
113 |
if (hasFixes) |
98 |
else |
114 |
return "org-netbeans-spi-editor-hints-parser_annotation_warn_fixable"; |
99 |
return "org-netbeans-spi-editor-hints-parser_annotation_warn"; |
115 |
else |
100 |
case VERIFIER: |
116 |
return "org-netbeans-spi-editor-hints-parser_annotation_warn"; |
101 |
if (hasFixes) |
117 |
case VERIFIER: |
102 |
return "org-netbeans-spi-editor-hints-parser_annotation_verifier_fixable"; |
118 |
if (hasFixes) |
103 |
else |
119 |
return "org-netbeans-spi-editor-hints-parser_annotation_verifier_fixable"; |
104 |
return "org-netbeans-spi-editor-hints-parser_annotation_verifier"; |
120 |
else |
105 |
case HINT: |
121 |
return "org-netbeans-spi-editor-hints-parser_annotation_verifier"; |
106 |
if (hasFixes) |
122 |
case HINT: |
107 |
return "org-netbeans-spi-editor-hints-parser_annotation_hint_fixable"; |
123 |
if (hasFixes) |
108 |
else |
124 |
return "org-netbeans-spi-editor-hints-parser_annotation_hint_fixable"; |
109 |
return "org-netbeans-spi-editor-hints-parser_annotation_hint"; |
125 |
else |
110 |
default: |
126 |
return "org-netbeans-spi-editor-hints-parser_annotation_hint"; |
111 |
throw new IllegalArgumentException(String.valueOf(severity)); |
127 |
default: |
|
|
128 |
throw new IllegalArgumentException(String.valueOf(severity)); |
129 |
} |
130 |
} else { |
131 |
return customType; |
112 |
} |
132 |
} |
113 |
} |
133 |
} |
114 |
|
134 |
|
Lines 141-146
Link Here
|
141 |
Severity getSeverity() { |
161 |
Severity getSeverity() { |
142 |
return severity; |
162 |
return severity; |
143 |
} |
163 |
} |
|
|
164 |
|
165 |
String getCustomType() { |
166 |
return customType; |
167 |
} |
144 |
|
168 |
|
145 |
private StyledDocument attachedTo; |
169 |
private StyledDocument attachedTo; |
146 |
|
170 |
|