org.netbeans.api.jackpot
Interface QueryContext
public interface QueryContext
A QueryContext is the environment that a Query is executed in, which
provides methods for communicating with the user through query results,
status bar and log messages, and errors.
Note: Query developers should never implement QueryContext.
The Jackpot module creates the QueryContext instance which the Query
will reference during its execution.
|
Method Summary |
void |
addChange(org.netbeans.api.java.source.TreePathHandle path,
org.openide.filesystems.FileObject file,
int start,
int end,
String label,
String note,
String newSource)
Add a tree which matches this query to the results set, along with its
replacement source code. |
void |
addResult(org.netbeans.api.java.source.TreePathHandle path,
org.openide.filesystems.FileObject file,
int start,
int end,
String label,
String note)
Add a tree which matches this query to the results set. |
PrintWriter |
getLogWriter()
Opens an output writer for log-type messages similar to what
javac sends to System.out. |
void |
sendErrorMessage(String message,
String title)
Send the application an error message regarding a query
execution. |
void |
sendStatusMessage(String message)
Send the application a status message. |
addResult
void addResult(org.netbeans.api.java.source.TreePathHandle path,
org.openide.filesystems.FileObject file,
int start,
int end,
String label,
String note)
- Add a tree which matches this query to the results set. If the query
extends TreePathScanner, its
getCurrentPath() method
returns the correct path for the visitor method which is currently visited.
- Parameters:
path - a handle to the path to the tree which matches this query.file - the source filestart - the begin text position of the matched treeend - the end text position of the matched treelabel - a short string describing the tree or an enclosing class member.note - an optional note with details about the match, or
null if there is no note.- See Also:
TreePathScanner.getCurrentPath()
addChange
void addChange(org.netbeans.api.java.source.TreePathHandle path,
org.openide.filesystems.FileObject file,
int start,
int end,
String label,
String note,
String newSource)
- Add a tree which matches this query to the results set, along with its
replacement source code. The new tree text is not the actual replacement text
(which normally has additional formatting), but is a simplified version
suitable for displaying in a user interface.
- Parameters:
path - a handle to the path to the tree which matches this query.file - the source filestart - the begin text position of the matched treeend - the end text position of the matched treelabel - a short string describing the tree or an enclosing class member.note - an optional note with details about the match, or
null if there is no note.newSource - a simple version of the replacement text- See Also:
TreePathScanner.getCurrentPath()
sendStatusMessage
void sendStatusMessage(String message)
- Send the application a status message. A status message should
normally be short enough to be displayed in the IDE's status bar.
Multiple status messages may be sent during a query.
- Parameters:
message - the message to be displayed in the status bar.
sendErrorMessage
void sendErrorMessage(String message,
String title)
- Send the application an error message regarding a query
execution. A long message may be sent, and normally a single
error message is sent during a single query execution.
- Parameters:
message - the error message to be displayed.title - the name of the query or a general error title.
getLogWriter
PrintWriter getLogWriter()
- Opens an output writer for log-type messages similar to what
javac sends to System.out.
- Returns:
- a java.io.PrintWriter to write log messages.
- See Also:
PrintWriter