Lines 129-134
Link Here
|
129 |
return null; |
129 |
return null; |
130 |
} |
130 |
} |
131 |
|
131 |
|
|
|
132 |
/**Create a new {@link ErrorDescription}. Severity is automatically inferred from the {@link HintContext}, |
133 |
* and the {@link ErrorDescription} is created to be consistent with {@link ErrorDescription}s created |
134 |
* by the other factory methods in this class. |
135 |
* |
136 |
* @param context from which the {@link Severity} and other properties are inferred. |
137 |
* @param start start of the warning |
138 |
* @param end end of the warning |
139 |
* @param text the warning text |
140 |
* @param fixes one or more {@link Fix}es to show shown to the user. |
141 |
* @return a standard {@link ErrorDescription} for use in Java source |
142 |
* @since 1.9 |
143 |
*/ |
144 |
public static ErrorDescription forSpan(HintContext context, int start, int end, String text, Fix... fixes) { |
145 |
if (context.getHintMetadata().kind != Hint.Kind.INSPECTION) { |
146 |
start = end = context.getCaretLocation(); |
147 |
} |
148 |
|
149 |
if (start != (-1) && end != (-1)) { |
150 |
LazyFixList fixesForED = org.netbeans.spi.editor.hints.ErrorDescriptionFactory.lazyListForFixes(resolveDefaultFixes(context, fixes)); |
151 |
return org.netbeans.spi.editor.hints.ErrorDescriptionFactory.createErrorDescription("text/x-java:" + context.getHintMetadata().id, context.getSeverity(), text, context.getHintMetadata().description, fixesForED, context.getInfo().getFileObject(), start, end); |
152 |
} |
153 |
|
154 |
return null; |
155 |
} |
156 |
|
132 |
public static ErrorDescription forName(HintContext context, TreePath tree, String text, Fix... fixes) { |
157 |
public static ErrorDescription forName(HintContext context, TreePath tree, String text, Fix... fixes) { |
133 |
return forName(context, tree.getLeaf(), text, fixes); |
158 |
return forName(context, tree.getLeaf(), text, fixes); |
134 |
} |
159 |
} |