KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > gsf > ParseEvent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.api.gsf;
20
21 import org.openide.filesystems.FileObject;
22
23 /**
24  * Based on the javac one
25  *
26  * Provides details about work that has been done by the Sun Java Compiler, javac.
27  *
28  * @author Jonathan Gibbons
29  * @since 1.6
30  */

31 public final class ParseEvent
32 {
33     /**
34      * Kind of task event.
35      * @since 1.6
36      */

37     public enum Kind {
38         /**
39          * For events related to the parsing of a file.
40          */

41     PARSE,
42         /**
43          * For events relating to elements being entered.
44          **/

45     ENTER,
46         /**
47          * For events relating to elements being analyzed for errors.
48          **/

49     ANALYZE,
50         /**
51          * For events relating to class files being generated.
52          **/

53     GENERATE,
54         /**
55          * For events relating to overall annotaion processing.
56          **/

57         ANNOTATION_PROCESSING,
58         /**
59          * For events relating to an individual annotation processing round.
60          **/

61         ANNOTATION_PROCESSING_ROUND
62     }
63     
64 // public TaskEvent(Kind kind) {
65
// this(kind, null, null, null);
66
// }
67
//
68
// public TaskEvent(Kind kind, JavaFileObject sourceFile) {
69
// this(kind, sourceFile, null, null);
70
// }
71
//
72
// public TaskEvent(Kind kind, CompilationUnitTree unit) {
73
// this(kind, unit.getSourceFile(), unit, null);
74
// }
75
//
76
// public TaskEvent(Kind kind, CompilationUnitTree unit, TypeElement clazz) {
77
// this(kind, unit.getSourceFile(), unit, clazz);
78
// }
79
//
80
public ParseEvent(Kind kind, ParserFile file, ParserResult result) {
81     this.kind = kind;
82     this.file = file;
83         this.result = result;
84     }
85
86     public Kind getKind() {
87     return kind;
88     }
89
90     public ParserFile getSourceFile() {
91     return file;
92     }
93
94 // public CompilationUnitTree getCompilationUnit() {
95
// return unit;
96
// }
97

98     public ParserResult getResult() {
99         return result;
100     }
101     
102 //
103
// public TypeElement getTypeElement() {
104
// return clazz;
105
// }
106

107     public String JavaDoc toString() {
108     return "TaskEvent["
109         + kind + ","
110         + file + ","
111         // the compilation unit is identified by the file
112
// + clazz + "]"
113
;
114     }
115
116     private final Kind kind;
117     private final ParserFile file;
118     private final ParserResult result;
119 }
120
Popular Tags