use of org.netxms.ui.eclipse.serverconfig.widgets.helpers.LogParser in project netxms by netxms.
the class LogParserEditor method updateBuilderFromXml.
/**
* Update parser builder from XML
*
* @param xml
*/
private void updateBuilderFromXml(String xml) {
if (parser != null) {
for (LogParserRule rule : parser.getRules()) rule.getEditor().dispose();
}
try {
parser = LogParser.createFromXml(xml);
} catch (Exception e) {
e.printStackTrace();
MessageDialogHelper.openError(getShell(), Messages.get().LogParserEditor_Error, Messages.get().LogParserEditor_InvalidDefinition);
parser = new LogParser();
}
parser.setSyslogParser(isSyslogParser);
/* general */
if (!isSyslogParser) {
labelFileName.setText(parser.getFile());
comboFileEncoding.setText((parser.getEncoding() == null) ? "AUTO" : parser.getEncoding());
}
spinerTrace.setSelection(parser.getTrace() != null ? parser.getTrace() : 0);
checkProcessAll.setSelection(parser.getProcessALL());
/* rules */
for (LogParserRule rule : parser.getRules()) createRuleEditor(rule).moveAbove(addColumnLink);
/* macros */
macroList.setInput(parser.getMacros().entrySet().toArray());
form.reflow(true);
form.getParent().layout(true, true);
}
Aggregations