Location l = warning.location.getSecondary();
int otherLocations = 0;
while (l != null) {
String message = l.getMessage();
if (message != null && !message.isEmpty()) {
Position start = l.getStart();
int line = start != null ? start.getLine() : -1;
String path = mClient.getDisplayPath(warning.project, l.getFile());
writeLocation(l.getFile(), path, line);
mWriter.write(':');
mWriter.write(' ');
mWriter.write("<span class=\"message\">"); //$NON-NLS-1$
appendEscapedText(message);
mWriter.write("</span>"); //$NON-NLS-1$
mWriter.write("<br />"); //$NON-NLS-1$
String name = l.getFile().getName();
if (!(endsWith(name, DOT_PNG) || endsWith(name, DOT_JPG))) {
String s = mClient.readFile(l.getFile());
if (s != null && !s.isEmpty()) {
mWriter.write("<pre class=\"errorlines\">\n"); //$NON-NLS-1$
int offset = start != null ? start.getOffset() : -1;
appendCodeBlock(s, line, offset);
mWriter.write("\n</pre>"); //$NON-NLS-1$
}
}
} else {
otherLocations++;
}
l = l.getSecondary();
}
mWriter.write("</ul>");
if (otherLocations > 0) {
String id = "Location" + count + "Div"; //$NON-NLS-1$
mWriter.write("<button id=\""); //$NON-NLS-1$
mWriter.write(id);
mWriter.write("Link\" onclick=\"reveal('"); //$NON-NLS-1$
mWriter.write(id);
mWriter.write("');\" />"); //$NON-NLS-1$
mWriter.write(String.format("+ %1$d Additional Locations...",
otherLocations));
mWriter.write("</button>\n"); //$NON-NLS-1$
mWriter.write("<div id=\""); //$NON-NLS-1$
mWriter.write(id);
mWriter.write("\" style=\"display: none\">\n"); //$NON-NLS-1$
mWriter.write("Additional locations: ");
mWriter.write("<ul>\n"); //$NON-NLS-1$
l = warning.location.getSecondary();
while (l != null) {
Position start = l.getStart();
int line = start != null ? start.getLine() : -1;
String path = mClient.getDisplayPath(warning.project, l.getFile());
mWriter.write("<li> "); //$NON-NLS-1$
writeLocation(l.getFile(), path, line);
mWriter.write("\n"); //$NON-NLS-1$
l = l.getSecondary();