KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > console > JikesJavacPatternMatcher


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ant.internal.ui.console;
12
13 import org.eclipse.ui.console.PatternMatchEvent;
14
15 public class JikesJavacPatternMatcher extends AbstractJavacPatternMatcher {
16
17     /*
18      * [javac] Found 1 semantic error compiling "/Users/kevinbarnes/Eclipse/runtime-workspace/Foo/src/CarriageReturn.java":
19      * [javac] 3. System.out.printer("\r");
20      */

21     public void matchFound(PatternMatchEvent event) {
22         String JavaDoc matchedText= getMatchedText(event);
23         if (matchedText == null) {
24             return;
25         }
26         int start = matchedText.indexOf('\"')+1;
27         int end = matchedText.indexOf('\"', start);
28         String JavaDoc filePath = matchedText.substring(start, end);
29         int eventOffset= event.getOffset();
30         int fileStart = matchedText.indexOf(filePath) + eventOffset;
31         int fileLength = filePath.length();
32         
33         int lineNumber = getLineNumber(eventOffset, false);
34         //TODO determine if error or warning
35
addLink(filePath, lineNumber, fileStart, fileLength, fgErrorType);
36     }
37 }
Popular Tags