Class FoldParserManager

java.lang.Object
org.fife.ui.rsyntaxtextarea.folding.FoldParserManager
All Implemented Interfaces:
SyntaxConstants

public final class FoldParserManager extends Object implements SyntaxConstants
Manages fold parsers. Instances of RSyntaxTextArea call into this class to retrieve fold parsers for whatever language they're editing. Folks implementing custom languages can add a FoldParser implementation for their language to this manager and it will be used by RSTA.
Version:
1.0
  • Field Details

  • Constructor Details

    • FoldParserManager

      private FoldParserManager()
      Private constructor to prevent instantiation.
  • Method Details

    • addFoldParserMapping

      public void addFoldParserMapping(String syntaxStyle, FoldParser parser)
      Adds a mapping from a syntax style to a fold parser. The parser specified will be shared among all RSTA instances editing that language, so it should be stateless (which should not be difficult for a fold parser). You can also override the fold parser for built-in languages, such as SYNTAX_STYLE_JAVA, with your own parser implementations.
      Parameters:
      syntaxStyle - The syntax style.
      parser - The parser.
      See Also:
    • createFoldParserMap

      private Map<String,FoldParser> createFoldParserMap()
      Creates the syntax style-to-fold parser mapping for built-in languages.
      Returns:
      The style-to-fold parser mapping.
    • get

      public static FoldParserManager get()
      Returns the singleton instance of this class.
      Returns:
      The singleton instance.
    • getFoldParser

      public FoldParser getFoldParser(String syntaxStyle)
      Returns a fold parser to use for an editor highlighting code of a specific language.
      Parameters:
      syntaxStyle - A value from SyntaxConstants, such as SYNTAX_STYLE_JAVA.
      Returns:
      A fold parser to use, or null if none is registered for the language.