org.gjt.sp.jedit.syntax
Class DefaultSyntaxDocument
- java.lang.Object
-
- javax.swing.text.AbstractDocument
-
- javax.swing.text.PlainDocument
-
- org.gjt.sp.jedit.syntax.DefaultSyntaxDocument
-
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.text.Document, SyntaxDocument
public class DefaultSyntaxDocument extends javax.swing.text.PlainDocument implements SyntaxDocument
A simple implementation ofSyntaxDocument. It also takes care of inserting and deleting lines from the token marker's state.- See Also:
SyntaxDocument, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classDefaultSyntaxDocument.DocumentHandlerAn implementation ofDocumentListenerthat inserts and deletes lines from the token marker's state.-
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
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
-
-
Field Summary
-
Constructor Summary
Constructors Constructor and Description DefaultSyntaxDocument()Creates a newDefaultSyntaxDocumentinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.awt.Color[]getColors()Returns the color array that maps token identifiers tojava.awt.Colorobjects.TokenMarkergetTokenMarker()Returns the token marker that is to be used to split lines of this document up into tokens.voidsetColors(java.awt.Color[] colors)Sets the color array that maps token identifiers tojava.awt.Colorojects.voidsetTokenMarker(TokenMarker tm)Sets the token marker that is to be used to split lines of this document up into tokens.voidtokenizeLines()Reparses the document, by passing all lines to the token marker.voidtokenizeLines(int start, int len)Reparses the document, by passing the specified lines to the token marker.-
Methods inherited from class javax.swing.text.PlainDocument
getDefaultRootElement, getParagraphElement, insertString
-
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.swing.text.Document
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render
-
-
-
-
Constructor Detail
-
DefaultSyntaxDocument
public DefaultSyntaxDocument()
Creates a newDefaultSyntaxDocumentinstance.
-
-
Method Detail
-
getTokenMarker
public TokenMarker getTokenMarker()
Returns the token marker that is to be used to split lines of this document up into tokens. May return null if this document is not to be colorized.- Specified by:
getTokenMarkerin interfaceSyntaxDocument
-
setTokenMarker
public void setTokenMarker(TokenMarker tm)
Sets the token marker that is to be used to split lines of this document up into tokens. May throw an exception if this is not supported for this type of document.- Specified by:
setTokenMarkerin interfaceSyntaxDocument- Parameters:
tm- The new token marker
-
getColors
public java.awt.Color[] getColors()
Returns the color array that maps token identifiers tojava.awt.Colorobjects.- Specified by:
getColorsin interfaceSyntaxDocument
-
setColors
public void setColors(java.awt.Color[] colors)
Sets the color array that maps token identifiers tojava.awt.Colorojects. May throw an exception if this is not supported for this type of document.- Specified by:
setColorsin interfaceSyntaxDocument- Parameters:
colors- The new color list
-
tokenizeLines
public void tokenizeLines()
Reparses the document, by passing all lines to the token marker. This should be called after the document is first loaded.- Specified by:
tokenizeLinesin interfaceSyntaxDocument
-
tokenizeLines
public void tokenizeLines(int start, int len)Reparses the document, by passing the specified lines to the token marker. This should be called after a large quantity of text is first inserted.- Specified by:
tokenizeLinesin interfaceSyntaxDocument- Parameters:
start- The first line to parselen- The number of lines, after the first one to parse
-
-
DataMelt 3.0 © DataMelt by jWork.ORG