@SuppressWarnings({"HardcodedLineSeparator"})
private String getSystemInformationAsHTML()
{
final CharacterEntityParser cep = HtmlCharacterEntities.getEntityParser();
final StringBuilder sb = new StringBuilder(10000);
sb.append("<html><body>\n");//NON-NLS
sb.append("<h1>");//NON-NLS
sb.append(cep.encodeEntities(UtilMessages.getInstance().getString("SystemInformationDialog.SystemProperties.Title")));
sb.append("</h1>");//NON-NLS
sb.append("<table>\n");//NON-NLS
final Map properties = new TreeMap(System.getProperties());
final Set<Object> enumeration = properties.keySet();
for (final Object key : enumeration)
{
String value = (String) properties.get(key.toString());
if (value != null)
{
value = cep.encodeEntities(value);
value = value.replace("\n", "\\n");//NON-NLS
value = value.replace("\f", "\\f");//NON-NLS
value = value.replace("\r", "\\r");//NON-NLS
if (value.length() > 80)
{
value = value.replace(File.pathSeparator, File.pathSeparator + "<br>\n");//NON-NLS
}
}
sb.append("<tr valign=\"top\"><td>");//NON-NLS
sb.append(cep.encodeEntities(key.toString()));
sb.append("</td><td>");//NON-NLS
sb.append(value);
sb.append("</td></tr>\n");//NON-NLS
}
sb.append("</table>");//NON-NLS
sb.append("<br>");//NON-NLS
//environment
sb.append("<h1>");//NON-NLS
sb.append(cep.encodeEntities(UtilMessages.getInstance().getString("SystemInformationDialog.Environment.Title")));
sb.append("</h1>");//NON-NLS
sb.append("<table>\n");//NON-NLS
final Map<String, String> environmentMap = new TreeMap<String, String>(System.getenv());
for (final String key : environmentMap.keySet())
{
String value = environmentMap.get(key);
if (value != null)
{
value = cep.encodeEntities(value);
value = value.replace("\n", "\\n");//NON-NLS
value = value.replace("\f", "\\f");//NON-NLS
value = value.replace("\r", "\\r");//NON-NLS
if (value.length() > 80)
{
value = value.replace(File.pathSeparator, File.pathSeparator + "<br>\n");//NON-NLS
}
}
sb.append("<tr valign=\"top\"><td>");//NON-NLS
sb.append(cep.encodeEntities(key));
sb.append("</td><td>");//NON-NLS
sb.append(value);
sb.append("</td></tr>\n");//NON-NLS
}
sb.append("</table>");//NON-NLS
sb.append("<br>");//NON-NLS
//other
sb.append("<h1>");//NON-NLS
sb.append(cep.encodeEntities(UtilMessages.getInstance().getString("SystemInformationDialog.Other.Title")));
sb.append("</h1>");//NON-NLS
sb.append("<table>\n");//NON-NLS
final Map<String, String> otherProperties = getOtherProperties();
for (final String key : otherProperties.keySet())
{
String value = otherProperties.get(key);
if (value != null)
{
value = cep.encodeEntities(value);
value = value.replace("\n", "\\n");//NON-NLS
value = value.replace("\f", "\\f");//NON-NLS
value = value.replace("\r", "\\r");//NON-NLS
if (value.length() > 80)
{
value = value.replace(File.pathSeparator, File.pathSeparator + "<br>\n");//NON-NLS
}
}
sb.append("<tr valign=\"top\"><td>");//NON-NLS
sb.append(cep.encodeEntities(key));
sb.append("</td><td>");//NON-NLS
sb.append(value).append("</td></tr>\n");//NON-NLS
}
sb.append("</table>");//NON-NLS