} catch (IOException e) {
}
}
} else {
StyledText helpPanel = new StyledText(cWhatsNew, SWT.VERTICAL | SWT.HORIZONTAL);
helpPanel.setEditable(false);
try {
helpPanel.setRedraw(false);
helpPanel.setWordWrap(false);
helpPanel.setFont(monospace);
black = ColorCache.getColor(display, 0, 0, 0);
white = ColorCache.getColor(display, 255, 255, 255);
light = ColorCache.getColor(display, 200, 200, 200);
grey = ColorCache.getColor(display, 50, 50, 50);
green = ColorCache.getColor(display, 30, 80, 30);
blue = ColorCache.getColor(display, 20, 20, 80);
int style;
boolean setStyle;
helpPanel.setForeground(grey);
String[] lines = sWhatsNew.split("\\r?\\n");
for (int i = 0; i < lines.length; i++) {
String line = lines[i];
setStyle = false;
fg = grey;
bg = white;
style = SWT.NORMAL;
char styleChar;
String text;
if (line.length() < 2) {
styleChar = ' ';
text = " " + lineSeparator;
} else {
styleChar = line.charAt(0);
text = line.substring(1) + lineSeparator;
}
switch (styleChar) {
case '*':
text = " * " + text;
fg = green;
setStyle = true;
break;
case '+':
text = " " + text;
fg = black;
bg = light;
style = SWT.BOLD;
setStyle = true;
break;
case '!':
style = SWT.BOLD;
setStyle = true;
break;
case '@':
fg = blue;
setStyle = true;
break;
case '$':
bg = blue;
fg = white;
style = SWT.BOLD;
setStyle = true;
break;
case ' ':
text = " " + text;
break;
default:
text = styleChar + text;
}
helpPanel.append(text);
if (setStyle) {
int lineCount = helpPanel.getLineCount() - 1;
int charCount = helpPanel.getCharCount();
// System.out.println("Got Linecount " + lineCount + ", Charcount " + charCount);
int lineOfs = helpPanel.getOffsetAtLine(lineCount - 1);
int lineLen = charCount - lineOfs;
// System.out.println("Setting Style : " + lineOfs + ", " + lineLen);
helpPanel.setStyleRange(new StyleRange(lineOfs, lineLen, fg, bg,
style));
helpPanel.setLineBackground(lineCount - 1, 1, bg);
}
}
helpPanel.setRedraw(true);
} catch (Exception e) {
System.out.println("Unable to load help contents because:" + e);
//e.printStackTrace();
}
}