public void parse() throws BadLocationException { final List<OutlineNodeDefinition<?>> nodeDefinitions = configuration.getAllOutlineLevelDefinitions(); final List<ShowInOutlineInstruction> showInOutlineInstructions = configuration.getInstructions(ShowInOutlineInstruction.class); String entry = null, header = null; for (int lineNumber = 0; lineNumber < numberOfLines; lineNumber++) { IRegion region = document.getLineInformation(lineNumber); String line = getLine(document, region); if (line.equals(MyContentOutlinePage.CONFIG_MARKER) || hasConfigSection) { onConfigLine(lineNumber, line, region); continue; } if (ParsingUtils.isLogEntryStart(line)) { header = line; entry = ParsingUtils.getLogEntry(document, lineNumber); } onAnyLine(lineNumber, line, entry, header, region); if (ParsingUtils.isLogEntryStart(line)) { onLogEntryLine(lineNumber, line, entry, region); } if (showInOutline(showInOutlineInstructions, line, entry, header)) { for (OutlineNodeDefinition<?> nodeDefinition : nodeDefinitions) { OutlineNodeContent content = nodeDefinition.recognize(lineNumber, line, entry, header, region, document); if (content != null) { @SuppressWarnings({"unchecked", "rawtypes"}) OutlineNode<?> node = new OutlineNode(nodeDefinition, content, region, lineNumber, line, document); outlineNodesMap.put(lineNumber, node); } } } } sortOutlineNodes(); dumpInfoToConfigSection(); }
private void sortOutlineNodes() { for (int level = 1; level <= configuration.getNumberOfLevels(); level++) { sortOutlineNodes(outlineNodesMap, level); // System.out.println("--- Outline nodes map after sorting at level " + level + " ---"); // dumpOutlineNodesMap(); } OutlineNode.createTreePositions(null, outlineNodesMap); }
public void onLogEntryLine(int lineNumber, String line, String entry, IRegion region) { if (!configuration.skipThreadProcessing) { registerThread(line); } Date date = ParsingUtils.parseDate(line); if (date != null) { long currentTimestamp = date.getTime(); if (lastTimestamp != null) { long delta = currentTimestamp - lastTimestamp; if (configuration.getErrorIfDelay() != null && delta >= configuration.getErrorIfDelay()) { addMarker( lineNumber, "Delay (" + delta + " msec) reached configured threshold of " + configuration.getErrorIfDelay() + " msec", IMarker.SEVERITY_ERROR); } else if (configuration.getWarningIfDelay() != null && delta >= configuration.getWarningIfDelay()) { addMarker( lineNumber, "Delay (" + delta + " msec) reached configured threshold of " + configuration.getWarningIfDelay() + " msec", IMarker.SEVERITY_WARNING); } else if (configuration.getInfoIfDelay() != null && delta >= configuration.getInfoIfDelay()) { addMarker( lineNumber, "Delay (" + delta + " msec) reached configured threshold of " + configuration.getInfoIfDelay() + " msec", IMarker.SEVERITY_INFO); } } lastTimestamp = currentTimestamp; } }
private void markLineIfNeeded( int lineNumber, String line, String entry, String header, IRegion region) { if (resource == null) { return; // no resource, no markers } int severity = -1; for (MarkProblemInstruction markInstruction : configuration.getInstructions(MarkProblemInstruction.class)) { if (markInstruction.matches(line, entry, header)) { severity = markInstruction.getSeverity(); break; } } if (severity >= 0) { addMarker(lineNumber, line, severity); } }