use of org.talend.designer.runprocess.IProcessMessage in project tdi-studio-se by Talend.
the class DebugProcessTosComposite method fillConsole.
@Override
protected void fillConsole(Collection<IProcessMessage> messages) {
//$NON-NLS-1$
consoleText.setText("");
for (IProcessMessage processMessage : messages) {
doAppendToConsole(processMessage);
}
scrollToEnd();
}
use of org.talend.designer.runprocess.IProcessMessage in project tdi-studio-se by Talend.
the class DebugProcessTosComposite method addPerlMark.
@Override
protected void addPerlMark(IProcessMessage psMess) {
if (psMess.getType().equals(MsgType.STD_ERR)) {
String content = psMess.getContent();
String path = null;
String uniName = null;
int lineNo = -1;
//$NON-NLS-1$
Pattern errorPattern = Pattern.compile("(.*) at (\\S+) line (\\d+)[\\.,]");
Matcher m = errorPattern.matcher(content);
String matchContent = null;
while (m.find()) {
path = m.group(2);
lineNo = parseInt(m.group(3));
matchContent = m.group();
if ((!("".equals(path)) && path != null) && lineNo > 0) {
//$NON-NLS-1$
uniName = Problems.setErrorMark(path, lineNo);
}
if (uniName != null) {
if (!errorMessMap.containsKey(uniName)) {
errorMessMap.put(uniName, new ProcessMessage(MsgType.STD_ERR, matchContent));
} else {
String uniMess = errorMessMap.get(uniName).getContent();
errorMessMap.put(uniName, new ProcessMessage(MsgType.STD_ERR, uniMess.concat(matchContent)));
}
}
}
}
refreshNode(psMess);
}
use of org.talend.designer.runprocess.IProcessMessage in project tdi-studio-se by Talend.
the class DebugProcessTosComposite method runProcessContextChanged.
private void runProcessContextChanged(final PropertyChangeEvent evt) {
String propName = evt.getPropertyName();
Display dis = Display.getCurrent();
if (dis == null) {
dis = Display.getDefault();
}
if (ProcessMessageManager.PROP_MESSAGE_ADD.equals(propName) || ProcessMessageManager.PROP_DEBUG_MESSAGE_ADD.equals(propName)) {
IProcessMessage psMess = (IProcessMessage) evt.getNewValue();
if (errorMessMap.size() <= CorePlugin.getDefault().getPreferenceStore().getInt(ITalendCorePrefConstants.PREVIEW_LIMIT)) {
if (!(LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL))) {
getAllErrorMess(psMess);
} else {
addPerlMark(psMess);
}
}
appendToConsole(psMess);
} else if (ProcessMessageManager.PROP_MESSAGE_CLEAR.equals(propName)) {
dis.asyncExec(new Runnable() {
@Override
public void run() {
if (!consoleText.isDisposed()) {
//$NON-NLS-1$
consoleText.setText("");
}
}
});
} else if (RunProcessContext.PROP_MONITOR.equals(propName)) {
// perfBtn.setSelection(((Boolean) evt.getNewValue()).booleanValue());
} else if (RunProcessContext.TRACE_MONITOR.equals(propName)) {
// traceBtn.setSelection(((Boolean) evt.getNewValue()).booleanValue());
} else if (RunProcessContext.PROP_RUNNING.equals(propName)) {
dis.asyncExec(new Runnable() {
@Override
public void run() {
if (isDisposed()) {
return;
}
boolean running = ((Boolean) evt.getNewValue()).booleanValue();
setRunnable(!running);
if (!killBtn.isDisposed() && killBtn != null) {
killBtn.setEnabled(running);
}
isRuning = false;
// previousRow.setEnabled(running);
// nextRow.setEnabled(running);
// nextBreakPoint.setEnabled(running);
}
});
}
}
use of org.talend.designer.runprocess.IProcessMessage in project tdi-studio-se by Talend.
the class ExecuteSystemCommandCommand method execute.
@Override
public void execute() {
if (commandsList == null || commandsList.isEmpty()) {
return;
}
List<IProcessMessage> consoleMessList = new ArrayList<IProcessMessage>();
final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
CommandProgressDialog progressDialog = new CommandProgressDialog(shell, commandsList, consoleMessList);
try {
progressDialog.executeProcess();
} catch (InvocationTargetException e) {
addCommandMessages(consoleMessList, CommandMsgType.CORE_ERR, e.toString());
} catch (InterruptedException e) {
addCommandMessages(consoleMessList, CommandMsgType.CORE_ERR, e.toString());
}
if (!consoleMessList.isEmpty()) {
ShowCommandMessage show = new ShowCommandMessage(shell, progressDialog.getCommands(), consoleMessList);
show.open();
}
}
use of org.talend.designer.runprocess.IProcessMessage in project tdi-studio-se by Talend.
the class TraceDebugProcessComposite method getAllErrorMess.
public void getAllErrorMess(IProcessMessage psMess) {
if (psMess.getType().equals(MsgType.STD_ERR)) {
String mess = psMess.getContent();
//$NON-NLS-1$
String[] linesMess = mess.split("\n");
StringBuffer currentMess = new StringBuffer();
String currenctJobName = processContext.getProcess().getName();
for (int i = 0; i < linesMess.length; i++) {
String tRunJobName = currenctJobName;
String linemess = linesMess[i].trim();
//$NON-NLS-1$
Pattern pattern = Pattern.compile("^Exception\\s*in\\s*component\\s*(\\w)+_\\d$");
Matcher m = pattern.matcher(linemess);
if (m.find()) {
List<Node> runjobList = getTRunjobList(processContext.getProcess());
//$NON-NLS-1$
String[] allwords = linemess.split("\\s");
String componentName = allwords[allwords.length - 1];
if (runjobList.size() > 0) {
int currentI = i;
if (currentI + 1 < linesMess.length - 1) {
// && currentI < linesMess.length - 1);
for (int j = currentI + 1; j < linesMess.length - 1; j++) {
tRunJobName = linesMess[j];
if ((tRunJobName.contains(componentName))) {
break;
}
}
if (tRunJobName.lastIndexOf("(") != -1 && tRunJobName.lastIndexOf(".java") != -1) {
tRunJobName = tRunJobName.substring(tRunJobName.lastIndexOf("(") + 1, tRunJobName.lastIndexOf(".java"));
} else {
tRunJobName = currenctJobName;
}
}
}
if (tRunJobName != null && tRunJobName.equals(currenctJobName)) {
if (i == 0) {
errorMessMap.put(componentName, psMess);
} else {
for (int j = i; j < linesMess.length; j++) {
//$NON-NLS-1$
currentMess.append(linesMess[j] + "\n");
}
IProcessMessage currentProMess = new ProcessMessage(MsgType.STD_ERR, currentMess.toString());
errorMessMap.put(componentName, currentProMess);
}
}
// break;
}
}
}
refreshNode(psMess);
}
Aggregations