public class JavaDocument
extends javax.swing.text.DefaultStyledDocument
Modifier and Type | Class and Description |
---|---|
private static class |
JavaDocument.CommentState
Enum to indicate the current comment state of the parser.
|
private static class |
JavaDocument.Mode
Enum to indicate the current mode (environment) of the parser.
|
javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit, javax.swing.text.DefaultStyledDocument.ElementBuffer, javax.swing.text.DefaultStyledDocument.ElementSpec, javax.swing.text.DefaultStyledDocument.SectionElement
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
Modifier and Type | Field and Description |
---|---|
private javax.swing.text.SimpleAttributeSet |
annotation
the style of annotations
|
private javax.swing.text.SimpleAttributeSet |
comment
the style of comments and line comments
|
private static java.awt.Color |
COMMENT_COLOR
highight color for comments (dull green)
|
private int |
currentPos
The current position of the parser in the inserted String.
|
private static java.lang.String |
DELIM
Regular expression character class for all chars which are delimiters
of keywords.
|
private static java.awt.Color |
JAVA_KEYWORD_COLOR
highight color for Java keywords (dark red/violet)
|
private javax.swing.text.SimpleAttributeSet |
javadoc
the style of JavaDoc
|
private static java.awt.Color |
JAVADOC_COLOR
highight color for JavaDoc (dull green)
|
private javax.swing.text.SimpleAttributeSet |
jml
the style of JML annotations
|
private static java.awt.Color |
JML_COLOR
highight color for JML (dark blue)
|
private static java.awt.Color |
JML_KEYWORD_COLOR
highight color for JML keywords (blue)
|
private javax.swing.text.SimpleAttributeSet |
jmlkeyword
the style of JML keywords
|
private java.util.Set<java.lang.String> |
jmlkeywords
stores the JML keywords
|
private static java.lang.String[] |
JMLKEYWORDS
Stores the JML keywords which have to be highlighted.
|
private javax.swing.text.SimpleAttributeSet |
keyword
the style of keywords
|
private java.util.Set<java.lang.String> |
keywords
stores the keywords
|
private static java.lang.String[] |
KEYWORDS
Stores the Java keywords which have to be highlighted.
|
private JavaDocument.Mode |
mode
Stores the mode in which the parser currently is.
|
private javax.swing.text.SimpleAttributeSet |
normal
default style
|
private static long |
serialVersionUID |
private JavaDocument.CommentState |
state
Stores the current comment state of the parser to recognize comments/comment ends.
|
private java.lang.String |
token
The current token of the parser.
|
private int |
tokenStart
The start index of the current token in the inserted String.
|
Constructor and Description |
---|
JavaDocument()
Creates a new JavaDocument and sets the syntax highlighting styles
(as in eclipse default settings).
|
Modifier and Type | Method and Description |
---|---|
private void |
checkAt() |
private void |
checkDelimiter(char c) |
private void |
checkLinefeed() |
private void |
checkOther(char c) |
private void |
checkQuote() |
private void |
checkSlash() |
private void |
checkStar() |
private void |
insertAnnotation(java.lang.String str,
int pos) |
private void |
insertCommentString(java.lang.String str,
int pos) |
private void |
insertJavadocString(java.lang.String str,
int pos) |
private void |
insertJMLString(java.lang.String str,
int pos) |
private void |
insertNormalString(java.lang.String str,
int pos) |
void |
insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet a) |
private void |
processChar(java.lang.String str) |
addDocumentListener, addStyle, create, createDefaultRoot, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, insert, insertUpdate, removeDocumentListener, removeElement, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, setParagraphAttributes, styleChanged
addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
private static final long serialVersionUID
private static final java.awt.Color JAVA_KEYWORD_COLOR
private static final java.awt.Color COMMENT_COLOR
private static final java.awt.Color JAVADOC_COLOR
private static final java.awt.Color JML_COLOR
private static final java.awt.Color JML_KEYWORD_COLOR
private static final java.lang.String DELIM
private static final java.lang.String[] KEYWORDS
private static final java.lang.String[] JMLKEYWORDS
private javax.swing.text.SimpleAttributeSet annotation
private javax.swing.text.SimpleAttributeSet normal
private javax.swing.text.SimpleAttributeSet keyword
private javax.swing.text.SimpleAttributeSet comment
private javax.swing.text.SimpleAttributeSet javadoc
private javax.swing.text.SimpleAttributeSet jml
private javax.swing.text.SimpleAttributeSet jmlkeyword
private java.util.Set<java.lang.String> keywords
private java.util.Set<java.lang.String> jmlkeywords
private int currentPos
private int tokenStart
private java.lang.String token
private JavaDocument.Mode mode
private JavaDocument.CommentState state
public JavaDocument()
private void checkAt()
private void checkLinefeed() throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void checkStar() throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void checkSlash() throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void checkQuote()
private void checkOther(char c)
private void checkDelimiter(char c)
private void processChar(java.lang.String str) throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void insertCommentString(java.lang.String str, int pos) throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void insertAnnotation(java.lang.String str, int pos) throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void insertJavadocString(java.lang.String str, int pos) throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void insertJMLString(java.lang.String str, int pos) throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
private void insertNormalString(java.lang.String str, int pos) throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
public void insertString(int offs, java.lang.String str, javax.swing.text.AttributeSet a) throws javax.swing.text.BadLocationException
insertString
in interface javax.swing.text.Document
insertString
in class javax.swing.text.AbstractDocument
javax.swing.text.BadLocationException