KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > apt > core > util > EclipseMessager


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 BEA Systems, Inc.
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  * tyeung@bea.com - initial API
10  *******************************************************************************/

11 package org.eclipse.jdt.apt.core.util;
12
13 import org.eclipse.jdt.core.dom.ASTNode;
14
15 import com.sun.mirror.apt.Messager;
16 import com.sun.mirror.util.SourcePosition;
17
18 /**
19  * Extend the APT {@link Messager} to allow the registrating of diagnostics on ast nodes.
20  */

21 public interface EclipseMessager extends Messager
22 {
23     /**
24      * Problem ID for APT problems that do not have quick fixes
25      */

26     public static final int APT_PROBLEM_ID = /*TODO: switch to IProblem.ExternalProblemNotFixable*/ 901;
27     
28     /**
29      * Problem ID for APT problems that have quick fixes.
30      * If an APT plugin wants to write a quick-fix for their problems,
31      * they should look for this ID.
32      *
33      * see org.eclipse.jdt.ui.text.java.IQuickAssistProcessor
34      */

35     public static final int APT_QUICK_FIX_PROBLEM_ID = /* TODO: switch to IProblem.ExternalProblemFixable*/ 900;
36     
37     
38     /**
39      * Print an error message on the given AST node.
40      * The AST node must came from the AST that is associated with the environment.
41      * @param node
42      * @param msg the error message
43      * @throws IllegalArgumentException if <code>node</code> or <code>msg</code> is null.
44      * Also, if the node did not come from the ast in the environment.
45      */

46     void printError(ASTNode node, String JavaDoc msg);
47     
48     /**
49      * Print a warning on the given AST node.
50      * The AST node must came from the AST that is associated with the environment.
51      * @param node
52      * @param msg the warning message
53      * @throws IllegalArgumentException if <code>node</code> or <code>msg</code> is null.
54      * Also, if the node did not come from the ast in the environment.
55      */

56     void printWarning(ASTNode node, String JavaDoc msg);
57     
58     /**
59      * Print a notice on the given AST node.
60      * The AST node must came from the AST that is associated with the environment.
61      * @param node
62      * @param msg the warning message
63      * @throws IllegalArgumentException if <code>node</code> or <code>msg</code> is null.
64      * Also, if the node did not come from the ast in the environment.
65      */

66     void printNotice(ASTNode node, String JavaDoc msg);
67     
68     /**
69      * Print an error including the given arguments for use
70      * in quick-fixes. Any APT Quick Fix processors (@see IAPTQuickFixProcessor)
71      * registered with the provided pluginId and errorId will
72      * then get called if the user attempt to quick-fix that error.
73      *
74      * @param pos position of the error
75      * @param msg message to display to the user
76      * @param pluginId plugin which will provide an apt quick fix processor
77      * for this error. Cannot be null.
78      * @param errorId a plugin-provided error code which will be meaningful
79      * to the quick fix processor (e.g. "invalidAnnotationValue", etc.)
80      * Cannot be null.
81      */

82     void printFixableError(SourcePosition pos, String JavaDoc msg, String JavaDoc pluginId, String JavaDoc errorId);
83     
84     /**
85      * Print a warning including the given arguments for use
86      * in quick-fixes. Any APT Quick Fix processors (@see IAPTQuickFixProcessor)
87      * registered with the provided pluginId and errorId will
88      * then get called if the user attempt to quick-fix that warning.
89      *
90      * @param pos position of the error
91      * @param msg message to display to the user
92      * @param pluginId plugin which will provide an apt quick fix processor
93      * for this error. Cannot be null.
94      * @param errorId a plugin-provided error code which will be meaningful
95      * to the quick fix processor (e.g. "invalidAnnotationValue", etc.)
96      * Cannot be null.
97      */

98     void printFixableWarning(SourcePosition pos, String JavaDoc msg, String JavaDoc pluginId, String JavaDoc errorId);
99     
100     /**
101      * Print a notice including the given arguments for use
102      * in quick-fixes. Any APT Quick Fix processors (@see IAPTQuickFixProcessor)
103      * registered with the provided pluginId and errorId will
104      * then get called if the user attempt to quick-fix that notice.
105      *
106      * @param pos position of the error
107      * @param msg message to display to the user
108      * @param pluginId plugin which will provide an apt quick fix processor
109      * for this error. Cannot be null.
110      * @param errorId a plugin-provided error code which will be meaningful
111      * to the quick fix processor (e.g. "invalidAnnotationValue", etc.)
112      * Cannot be null.
113      */

114     void printFixableNotice(SourcePosition pos, String JavaDoc msg, String JavaDoc pluginId, String JavaDoc errorId);
115     
116     /**
117      * Print an error including the given arguments for use
118      * in quick-fixes. Any APT Quick Fix processors (@see IAPTQuickFixProcessor)
119      * registered with the provided pluginId and errorId will
120      * then get called if the user attempt to quick-fix that error.
121      *
122      * @param msg message to display to the user
123      * @param pluginId plugin which will provide an apt quick fix processor
124      * for this error. Cannot be null.
125      * @param errorId a plugin-provided error code which will be meaningful
126      * to the quick fix processor (e.g. "invalidAnnotationValue", etc.)
127      * Cannot be null.
128      */

129     void printFixableError(String JavaDoc msg, String JavaDoc pluginId, String JavaDoc errorId);
130     
131     /**
132      * Print a warning including the given arguments for use
133      * in quick-fixes. Any APT Quick Fix processors (@see IAPTQuickFixProcessor)
134      * registered with the provided pluginId and errorId will
135      * then get called if the user attempt to quick-fix that warning.
136      *
137      * @param msg message to display to the user
138      * @param pluginId plugin which will provide an apt quick fix processor
139      * for this error. Cannot be null.
140      * @param errorId a plugin-provided error code which will be meaningful
141      * to the quick fix processor (e.g. "invalidAnnotationValue", etc.)
142      * Cannot be null.
143      */

144     void printFixableWarning(String JavaDoc msg, String JavaDoc pluginId, String JavaDoc errorId);
145     
146     /**
147      * Print a notice including the given arguments for use
148      * in quick-fixes. Any APT Quick Fix processors (@see IAPTQuickFixProcessor)
149      * registered with the provided pluginId and errorId will
150      * then get called if the user attempt to quick-fix that notice.
151      *
152      * @param msg message to display to the user
153      * @param pluginId plugin which will provide an apt quick fix processor
154      * for this error. Cannot be null.
155      * @param errorId a plugin-provided error code which will be meaningful
156      * to the quick fix processor (e.g. "invalidAnnotationValue", etc.)
157      * Cannot be null.
158      */

159     void printFixableNotice(String JavaDoc msg, String JavaDoc pluginId, String JavaDoc errorId);
160 }
161
Popular Tags