SyntaxDocument

processing.app.syntax

## Class SyntaxDocument

- Object
- - AbstractDocument
  - - PlainDocument
    - - SyntaxDocument

- All Implemented Interfaces:
    Serializable, Document

      public class SyntaxDocument
      extends PlainDocument

  A document implementation that can be tokenized by the syntax highlighting system.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class AbstractDocument

      `AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement`

  - ### Field Summary

    - ### Fields inherited from class PlainDocument

      `lineLimitAttribute, tabSizeAttribute`

    - ### Fields inherited from class AbstractDocument

      `BidiElementName, ContentElementName, ElementNameAttribute, ParagraphElementName, SectionElementName`

    - ### Fields inherited from interface Document

      `StreamDescriptionProperty, TitleProperty`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SyntaxDocument()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addUndoableEdit(UndoableEdit edit)` Adds an undoable edit to this document's undo list.
    `void` | `beginCompoundEdit()` Starts a compound edit that can be undone in one operation.
    `void` | `endCompoundEdit()` Ends a compound edit that can be undone in one operation.
    `TokenMarker` | `getTokenMarker()` Returns the token marker that is to be used to split lines of this document up into tokens.
    `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(int start, int len)` Reparses the document, by passing the specified lines to the token marker.

    - ### Methods inherited from class PlainDocument

      `getDefaultRootElement, getParagraphElement, insertString`

    - ### Methods inherited from class 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 Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SyntaxDocument

          public SyntaxDocument()

  - ### 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.

    - #### 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.
      Parameters:
        `tm` - The new token marker

    - #### 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.

    - #### 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.
      Parameters:
        `start` - The first line to parse
        `len` - 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

          public void addUndoableEdit(UndoableEdit edit)

      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