addHyperlinkListener(new MyHyperlinkListener());
setTransferHandler(new RetainLineBreakTransferHandler());
}
String getRuleMatchHtml(List<RuleMatch> ruleMatches, String text, String startCheckText) {
final ContextTools contextTools = new ContextTools();
final StringBuilder sb = new StringBuilder();
sb.append(startCheckText);
sb.append("<br>\n");
int i = 0;
for (final RuleMatch match : ruleMatches) {
final String output = Tools.makeTexti18n(messages, "result1", i + 1, match.getLine() + 1, match.getColumn());
sb.append(output);
final String msg = match.getMessage()
.replaceAll("<suggestion>", "<b>").replaceAll("</suggestion>", "</b>")
.replaceAll("<old>", "<b>").replaceAll("</old>", "</b>");
sb.append("<b>").append(messages.getString("errorMessage")).append("</b> ");
sb.append(msg);
final RuleLink ruleLink = RuleLink.buildDeactivationLink(match.getRule());
sb.append(" <a href=\"").append(ruleLink).append("\">").append(messages.getString("deactivateRule")).append("</a><br>\n");
if (match.getSuggestedReplacements().size() > 0) {
final String replacement = StringTools.listToString(match.getSuggestedReplacements(), "; ");
sb.append("<b>").append(messages.getString("correctionMessage")).append("</b> ").append(replacement).append("<br>\n");
}
if (match.getRule() instanceof SpellingCheckRule) {
contextTools.setErrorMarkerStart(SPELL_ERROR_MARKER_START);
} else {
contextTools.setErrorMarkerStart(LT_ERROR_MARKER_START);
}
final String context = contextTools.getContext(match.getFromPos(), match.getToPos(), text);
sb.append("<b>").append(messages.getString("errorContext")).append("</b> ").append(context);
sb.append("<br>\n");
if (match.getRule().getUrl() != null && Desktop.isDesktopSupported()) {
sb.append("<b>").append(messages.getString("moreInfo")).append("</b> <a href=\"");
final String url = match.getRule().getUrl().toString();