public class JavaParser extends org.fife.ui.rsyntaxtextarea.parser.AbstractParser
Like all RSTA Parsers, a JavaParser instance is notified
when the RSTA's text content changes. After a small delay, it will parse
the content as Java code, building an AST and looking for any errors. When
parsing is complete, a property change event of type
PROPERTY_COMPILATION_UNIT is fired. Listeners can check the new
value of the property for the CompilationUnit built that represents
the source code in the text area. Note that the CompilationUnit
may be incomplete if there were parsing/syntax errors (it will usually be
complete "up to" the error in the content).
This parser cannot be shared amongst multiple instances of RSyntaxTextArea.
Please keep in mind that this class is a work-in-progress!
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_COMPILATION_UNIT
The property change event that's fired when the document is re-parsed.
|
| Constructor and Description |
|---|
JavaParser(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(java.lang.String prop,
java.beans.PropertyChangeListener l)
Adds a listener to this parser.
|
CompilationUnit |
getCompilationUnit()
Returns the compilation unit from the last time the text area was
parsed.
|
int |
getOffset(org.fife.ui.rsyntaxtextarea.RSyntaxDocument doc,
ParserNotice notice)
Returns the offset into the document of a parser notice.
|
org.fife.ui.rsyntaxtextarea.parser.ParseResult |
parse(org.fife.ui.rsyntaxtextarea.RSyntaxDocument doc,
java.lang.String style) |
void |
removePropertyChangeListener(java.lang.String prop,
java.beans.PropertyChangeListener l)
Removes a property change listener from this parser.
|
getHyperlinkListener, getImageBase, isEnabled, setEnabled, setHyperlinkListenerpublic static final java.lang.String PROPERTY_COMPILATION_UNIT
public JavaParser(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
textArea - The text area to parse.public void addPropertyChangeListener(java.lang.String prop,
java.beans.PropertyChangeListener l)
prop - The property to listen for changes to.l - The listener to add.removePropertyChangeListener(String, PropertyChangeListener)public CompilationUnit getCompilationUnit()
null if it hasn't yet
been parsed or an unexpected error occurred while parsing.public int getOffset(org.fife.ui.rsyntaxtextarea.RSyntaxDocument doc, ParserNotice notice)
doc - The document.notice - The parser notice.-1 if it is invalid.public org.fife.ui.rsyntaxtextarea.parser.ParseResult parse(org.fife.ui.rsyntaxtextarea.RSyntaxDocument doc, java.lang.String style)
public void removePropertyChangeListener(java.lang.String prop,
java.beans.PropertyChangeListener l)
prop - The property being listened to.l - The listener to remove.addPropertyChangeListener(String, PropertyChangeListener)