private void setLatest()

in src/main/java/org/jetbrains/plugins/spotbugs/gui/settings/DetectorDetailsPane.java [108:166]


	private void setLatest(@Nullable final DetectorFactory detector) throws Exception {
		final String html = detector != null ? detector.getDetailHTML() : EMPTY_HTML;
		String body = null;
		int pos = html.indexOf("<BODY>");
		if (-1 != pos) {
			body = html.substring(pos + "<BODY>".length());
			pos = body.indexOf("</BODY>");
			if (-1 != pos) {
				body = body.substring(0, pos);
				body = StringUtilFb.trim(body, ' ', '\n', '\r', '\t');
				if (body.startsWith("<p>")) {
					body = body.substring("<p>".length());
					body = StringUtilFb.trim(body, ' ', '\n', '\r', '\t');
					if (body.endsWith("<p></p>")) {
						body = body.substring(0, body.length() - "<p></p>".length());
					}
					body = StringUtilFb.trim(body, ' ', '\n', '\r', '\t');
					if (body.endsWith("</p>")) {
						body = body.substring(0, body.length() - "</p>".length());
					}
				}
				body = StringUtilFb.trim(body, ' ', '\n', '\r', '\t');
			} else {
				body = null;
			}
		}

		if (detector != null && body != null) {
			final StringBuilder s = new StringBuilder();
			s.append("\n\n<table border=1>");
			s.append("<tr><td>").append(ResourcesLoader.getString("detector.details.plugin")).append("</td><td>").append(detector.getPlugin().getShortDescription()).append("</td></tr>");
			s.append("<tr><td>").append(ResourcesLoader.getString("detector.details.pluginId")).append("</td><td>").append(detector.getPlugin().getPluginId()).append("</td></tr>");
			s.append("<tr><td>").append(ResourcesLoader.getString("detector.details.detectorName")).append("</td><td>").append(detector.getShortName()).append("</td></tr>");
			s.append("</table>");
			final Set<BugPattern> bugPatterns = detector.getReportedBugPatterns();
			if (bugPatterns.isEmpty()) {
				s.append("\n<b>").append(ResourcesLoader.getString("detector.details.noReportedPatterns")).append("</b>");
			} else {
				s.append("\n").append(ResourcesLoader.getString("detector.details.reportedPatterns")).append(":");
				s.append("<table border=1>");
				for (final BugPattern pattern : bugPatterns) {
					s.append("<tr>")
							.append("<td>").append(pattern.getCategory()).append("</td>")
							.append("<td>").append(pattern.getAbbrev()).append("</td>")
							.append("<td>").append(pattern.getType()).append("</td>")
							.append("<td>").append(pattern.getShortDescription()).append("</td>")
							.append("</tr>");

				}
				s.append("</table>");
			}
			body += s.toString();
		}

		final HintHint hintHint = new HintHint(description, new Point(0, 0));
		hintHint.setFont(UIUtil.getLabelFont());
		latest = HintUtil.prepareHintText(body != null ? body : html, hintHint);

	}