public class SyntaxDocument
extends javax.swing.text.PlainDocument
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 |
---|---|
protected boolean |
editable
True if the document is editable.
|
protected javax.swing.undo.UndoManager |
manager
The document UndoManager.
|
protected TokenMarker |
tokenMarker
The document TokenMarker.
|
Constructor and Description |
---|
SyntaxDocument() |
Modifier and Type | Method and Description |
---|---|
protected void |
fireInsertUpdate(javax.swing.event.DocumentEvent evt)
We overwrite this method to update the token marker state immediately so that any event listeners get a consistent token marker.
|
protected void |
fireRemoveUpdate(javax.swing.event.DocumentEvent evt)
We overwrite this method to update the token marker state immediately so that any event listeners get a consistent token marker.
|
int |
getLineOfOffset(int offset)
Returns the line containing the specified offset.
|
TokenMarker |
getTokenMarker()
Returns the token marker that is to be used to split lines of this document up into tokens.
|
javax.swing.undo.UndoManager |
getUndoManager()
Return the document UndoManager.
|
void |
insertString(int offs,
java.lang.String string,
javax.swing.text.AttributeSet a) |
void |
remove(int offs,
int length) |
void |
setEditable(boolean editable)
Set if the document is editable.
|
void |
setTokenMarker(TokenMarker tm)
Sets the token marker that is to be used to split lines of this document up into tokens.
|
void |
tokenizeLines()
Reparses the document, by passing all lines to the token marker.
|
void |
tokenizeLines(boolean forceMultiline)
Reparses the document, by passing all lines to the token marker.
|
void |
tokenizeLines(int start,
int len)
Reparses the document, by passing the specified lines to the token marker.
|
void |
tokenizeLines(int start,
int len,
boolean forceMultiline)
Reparses the document, by passing the specified lines to the token marker.
|
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
protected TokenMarker tokenMarker
protected javax.swing.undo.UndoManager manager
protected boolean editable
public void setEditable(boolean editable)
editable
- true if the document is editablepublic javax.swing.undo.UndoManager getUndoManager()
public TokenMarker getTokenMarker()
public void insertString(int offs, java.lang.String string, javax.swing.text.AttributeSet a) throws javax.swing.text.BadLocationException
insertString
in interface javax.swing.text.Document
insertString
in class javax.swing.text.PlainDocument
javax.swing.text.BadLocationException
public void remove(int offs, int length) throws javax.swing.text.BadLocationException
remove
in interface javax.swing.text.Document
remove
in class javax.swing.text.AbstractDocument
javax.swing.text.BadLocationException
public final int getLineOfOffset(int offset)
offset
- The offsetpublic void setTokenMarker(TokenMarker tm)
tm
- the new token markerpublic void tokenizeLines()
public void tokenizeLines(boolean forceMultiline)
forceMultiline
- true if the tokenization will be performed even if the Tokenmarker does not
support multilinepublic void tokenizeLines(int start, int len)
start
- The first line to parselen
- The number of lines, after the first one to parsepublic void tokenizeLines(int start, int len, boolean forceMultiline)
start
- The first line to parselen
- The number of lines, after the first one to parseforceMultiline
- true if the tokenization will be performed even if the Tokenmarker does not
support multilineprotected void fireInsertUpdate(javax.swing.event.DocumentEvent evt)
fireInsertUpdate
in class javax.swing.text.AbstractDocument
evt
- the DocumentEventprotected void fireRemoveUpdate(javax.swing.event.DocumentEvent evt)
fireRemoveUpdate
in class javax.swing.text.AbstractDocument
evt
- the DocumentEventCopyright © 2016, 2017, 2018, 2019, 2023 Herve Girod. All Rights Reserved. Documentation and source under the MIT licence