Package mars.venus.editor.jeditsyntax
Class SyntaxDocument
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
mars.venus.editor.jeditsyntax.SyntaxDocument
- All Implemented Interfaces:
Serializable
,Document
A document implementation that can be tokenized by the syntax highlighting
system.
- Version:
- $Id: SyntaxDocument.java,v 1.14 1999/12/13 03:40:30 sp Exp $
- Author:
- Slava Pestov
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
-
Field Summary
FieldsFields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addUndoableEdit
(UndoableEdit edit) Adds an undoable edit to this document's undo list.void
Starts a compound edit that can be undone in one operation.void
Ends a compound edit that can be undone in one operation.protected void
We overwrite this method to update the token marker state immediately so that any event listeners get a consistent token marker.protected void
We overwrite this method to update the token marker state immediately so that any event listeners get a consistent token marker.Returns the token marker that is to be used to split lines of this document up into tokens.void
setTokenMarker
(TokenMarker marker) Sets the token marker that is to be used to split lines of this document up into tokens.void
Parses the document by passing all lines to the token marker.void
tokenizeLines
(int start, int count) Parses the document by passing the specified lines to the token marker.Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertString, insertUpdate, removeUpdate
Methods inherited from class javax.swing.text.AbstractDocument
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, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
-
Field Details
-
tokenMarker
-
-
Constructor Details
-
SyntaxDocument
public SyntaxDocument()
-
-
Method Details
-
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. -
setTokenMarker
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.- Parameters:
marker
- The new token marker
-
tokenizeLines
public void tokenizeLines()Parses the document by passing all lines to the token marker. This should be called after the document is first loaded. -
tokenizeLines
public void tokenizeLines(int start, int count) Parses the document by passing the specified lines to the token marker. This should be called after a large quantity of text is first inserted.- Parameters:
start
- The first line to parsecount
- The number of lines, after the first one to parse
-
beginCompoundEdit
public void beginCompoundEdit()Starts a compound edit that can be undone in one operation. Subclasses that implement undo should override this method; this class has no undo functionality so this method is empty. -
endCompoundEdit
public void endCompoundEdit()Ends a compound edit that can be undone in one operation. Subclasses that implement undo should override this method; this class has no undo functionality so this method is empty. -
addUndoableEdit
Adds an undoable edit to this document's undo list. The edit should be ignored if something is currently being undone.- Parameters:
edit
- The undoable edit- Since:
- jEdit 2.2pre1
-
fireInsertUpdate
We overwrite this method to update the token marker state immediately so that any event listeners get a consistent token marker.- Overrides:
fireInsertUpdate
in classAbstractDocument
-
fireRemoveUpdate
We overwrite this method to update the token marker state immediately so that any event listeners get a consistent token marker.- Overrides:
fireRemoveUpdate
in classAbstractDocument
-