use of org.talend.designer.runprocess.ProcessMessage.MsgType in project tdi-studio-se by Talend.
the class DebugProcessTosComposite method doAppendToConsole.
private void doAppendToConsole(final IProcessMessage message) {
if (consoleText.isDisposed()) {
return;
}
// see feature 0004895: Font size of the output console are very small
setConsoleFont();
//$NON-NLS-1$
String[] rows = message.getContent().split("\n");
int rowLimit = getConsoleRowLimit();
String content = null;
if (rowLimit != SWT.DEFAULT) {
int currentRows = consoleText.getLineCount();
// if (consoleText.getText().equals("")) {
currentRows--;
// }
if (currentRows >= rowLimit) {
return;
} else if (currentRows + rows.length <= rowLimit) {
content = message.getContent();
} else {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rowLimit - currentRows; i++) {
//$NON-NLS-1$
sb.append(rows[i]).append("\n");
}
content = sb.toString();
}
}
if (content == null) {
content = message.getContent();
}
StyleRange style = new StyleRange();
style.start = consoleText.getText().length();
String[] contents = content.split("\n");
for (String content2 : contents) {
if (isPattern(content2) || isPatternFor(content2)) {
//$NON-NLS-1$
consoleText.append("");
//$NON-NLS-1$
content = "";
} else {
consoleText.append(content2);
consoleText.append("\n");
}
}
style.length = content.length();
if (message.getType() == MsgType.CORE_OUT || message.getType() == MsgType.CORE_ERR) {
style.fontStyle = SWT.ITALIC;
}
Color color;
switch((MsgType) message.getType()) {
case CORE_OUT:
color = getDisplay().getSystemColor(SWT.COLOR_BLUE);
break;
case CORE_ERR:
color = getDisplay().getSystemColor(SWT.COLOR_DARK_RED);
break;
case STD_ERR:
color = getDisplay().getSystemColor(SWT.COLOR_RED);
break;
case STD_OUT:
default:
color = getDisplay().getSystemColor(SWT.COLOR_BLACK);
break;
}
style.foreground = color;
// added by hyWang for bug 0007411
if ((style.start + style.length) > consoleText.getCharCount()) {
style.length = consoleText.getCharCount() - style.start;
}
consoleText.setStyleRange(style);
}
use of org.talend.designer.runprocess.ProcessMessage.MsgType in project tdi-studio-se by Talend.
the class TraceDebugProcessComposite method doAppendToConsole.
private void doAppendToConsole(final IProcessMessage message) {
if (consoleText.isDisposed()) {
return;
}
// see feature 0004895: Font size of the output console are very small
setConsoleFont();
//$NON-NLS-1$
String[] rows = message.getContent().split("\n");
int rowLimit = getConsoleRowLimit();
String content = null;
if (rowLimit != SWT.DEFAULT) {
int currentRows = consoleText.getLineCount();
// if (consoleText.getText().equals("")) {
currentRows--;
// }
if (currentRows >= rowLimit) {
return;
} else if (currentRows + rows.length <= rowLimit) {
content = message.getContent();
} else {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < rowLimit - currentRows; i++) {
//$NON-NLS-1$
sb.append(rows[i]).append("\n");
}
content = sb.toString();
}
}
if (content == null) {
content = message.getContent();
}
StyleRange style = new StyleRange();
style.start = consoleText.getText().length();
String[] contents = content.split("\n");
for (String content2 : contents) {
if (isPattern(content2) || isPatternFor(content2)) {
//$NON-NLS-1$
consoleText.append("");
//$NON-NLS-1$
content = "";
} else {
consoleText.append(content2);
consoleText.append("\n");
}
}
style.length = content.length();
if (message.getType() == MsgType.CORE_OUT || message.getType() == MsgType.CORE_ERR) {
style.fontStyle = SWT.ITALIC;
}
Color color;
switch((MsgType) message.getType()) {
case CORE_OUT:
color = getDisplay().getSystemColor(SWT.COLOR_BLUE);
break;
case CORE_ERR:
color = getDisplay().getSystemColor(SWT.COLOR_DARK_RED);
break;
case STD_ERR:
color = getDisplay().getSystemColor(SWT.COLOR_RED);
break;
case STD_OUT:
default:
color = getDisplay().getSystemColor(SWT.COLOR_BLACK);
break;
}
style.foreground = color;
// added by hyWang for bug 0007411
if ((style.start + style.length) > consoleText.getCharCount()) {
style.length = consoleText.getCharCount() - style.start;
}
consoleText.setStyleRange(style);
}
Aggregations