1 11 package org.eclipse.ant.internal.ui.console; 12 13 import org.eclipse.ant.internal.ui.AntUIPlugin; 14 import org.eclipse.ui.console.PatternMatchEvent; 15 16 public class JavacPatternMatcher extends AbstractJavacPatternMatcher { 17 18 21 public void matchFound(PatternMatchEvent event) { 22 String matchedText= getMatchedText(event); 23 if (matchedText == null) { 24 return; 25 } 26 27 int numEnd= matchedText.lastIndexOf(':'); 28 while (numEnd > 1 && !Character.isDigit(matchedText.charAt(numEnd - 1))) { 29 numEnd= matchedText.lastIndexOf(':', numEnd - 1); 30 } 31 int numStart= matchedText.lastIndexOf(':', numEnd - 1); 32 33 int index = matchedText.indexOf("]"); 35 String filePath; 36 if (numStart == -1) { 37 filePath= matchedText.substring(index + 1); 39 filePath = filePath.trim(); 40 int fileStart = matchedText.indexOf(filePath); 41 int eventOffset= event.getOffset() + fileStart; 42 int eventLength = filePath.length(); 43 addLink(filePath, -1, eventOffset, eventLength, null); 44 } else { 45 filePath= matchedText.substring(index + 1, numStart); 46 filePath = filePath.trim(); 47 48 int fileStart = matchedText.indexOf(filePath); 49 int eventOffset= event.getOffset() + fileStart; 50 int eventLength = filePath.length(); 51 52 String lineNumberString = matchedText.substring(numStart + 1, numEnd); 53 int lineNumber= -1; 54 try { 55 lineNumber= Integer.parseInt(lineNumberString); 56 } catch (NumberFormatException e) { 57 AntUIPlugin.log(e); 58 } 59 60 Integer type= fgErrorType; 61 if (-1 != matchedText.indexOf("warning", numEnd)) { type= fgWarningType; 63 } 64 addLink(filePath, lineNumber, eventOffset, eventLength, type); 65 } 66 } 67 } | Popular Tags |