|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LocatedMessage.java | 0% | 0% | 0% | 0% |
|
1 |
package org.codehaus.groovy.control.messages;
|
|
2 |
|
|
3 |
import java.io.PrintWriter;
|
|
4 |
|
|
5 |
import org.codehaus.groovy.control.Janitor;
|
|
6 |
import org.codehaus.groovy.control.ProcessingUnit;
|
|
7 |
import org.codehaus.groovy.control.SourceUnit;
|
|
8 |
import org.codehaus.groovy.syntax.CSTNode;
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
/**
|
|
13 |
* A base class for compilation messages.
|
|
14 |
*
|
|
15 |
* @author <a href="mailto:cpoirier@dreaming.org">Chris Poirier</a>
|
|
16 |
*
|
|
17 |
* @version $Id: LocatedMessage.java,v 1.1 2004/04/19 07:29:45 cpoirier Exp $
|
|
18 |
*/
|
|
19 |
|
|
20 |
public class LocatedMessage extends SimpleMessage |
|
21 |
{ |
|
22 |
protected CSTNode context; // The CSTNode that indicates the location to which the message applies |
|
23 |
|
|
24 |
|
|
25 | 0 |
public LocatedMessage( String message, CSTNode context )
|
26 |
{ |
|
27 | 0 |
super( message );
|
28 | 0 |
this.context = context;
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 | 0 |
public LocatedMessage( String message, Object data, CSTNode context )
|
33 |
{ |
|
34 | 0 |
super( message, data );
|
35 | 0 |
this.context = context;
|
36 |
} |
|
37 |
|
|
38 |
|
|
39 | 0 |
public void write( PrintWriter writer, ProcessingUnit owner, Janitor janitor ) |
40 |
{ |
|
41 | 0 |
SourceUnit source = (SourceUnit)owner; // This is reliably true
|
42 |
|
|
43 | 0 |
String name = source.getName(); |
44 | 0 |
int line = context.getStartLine();
|
45 | 0 |
int column = context.getStartColumn();
|
46 | 0 |
String sample = source.getSample( line, column, janitor ); |
47 |
|
|
48 | 0 |
if( sample != null ) |
49 |
{ |
|
50 | 0 |
writer.println( source.getSample(line, column, janitor) ); |
51 |
} |
|
52 |
|
|
53 | 0 |
writer.println( name + ": " + line + ": " + this.message ); |
54 | 0 |
writer.println("");
|
55 |
} |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|