1 11 package org.eclipse.ant.internal.ui.console; 12 13 import org.eclipse.ui.console.PatternMatchEvent; 14 15 public class EclipseJavacPatternMatcher extends AbstractJavacPatternMatcher { 16 17 private static final String fgError= "ERROR in"; private static final String fgWarning= "WARNING in"; private static final String fgStartOfLineNumber= " ("; 21 23 public void matchFound(PatternMatchEvent event) { 24 String matchedText= getMatchedText(event); 25 if (matchedText == null) { 26 return; 27 } 28 int index = matchedText.indexOf(fgError); 29 String filePath; 30 Integer type= fgErrorType; 31 if (index == -1) { 32 index = matchedText.indexOf(fgWarning); 33 filePath= matchedText.substring(index + 10).trim(); 34 type= fgWarningType; 35 } else { 36 filePath= matchedText.substring(index + 8).trim(); 37 } 38 39 int lineNumberStart = filePath.lastIndexOf(fgStartOfLineNumber); 40 if (lineNumberStart != -1) { 41 filePath = filePath.substring(0, lineNumberStart); 42 } 43 44 int fileStart = matchedText.indexOf(filePath); 45 int eventOffset= event.getOffset() + fileStart; 46 int eventLength = filePath.length(); 47 48 int lineNumber = getLineNumber(lineNumberStart + eventOffset, true); 49 addLink(filePath, lineNumber, eventOffset, eventLength, type); 50 } 51 } | Popular Tags |