Class SyntaxUtilities


  • public class SyntaxUtilities
    extends java.lang.Object
    Class with several utility functions used by jEdit's syntax colorizing subsystem.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull SyntaxStyles getDefaultSyntaxStyles()
      Returns the default styles.
      static int paintSyntaxLine​(@NotNull javax.swing.text.Segment line, @NotNull java.lang.Iterable<Token> tokens, @NotNull SyntaxStyles styles, @NotNull javax.swing.text.TabExpander expander, @NotNull java.awt.Graphics gfx, int x, int y)
      Paints the specified line onto the graphics context.
      static boolean regionMatches​(boolean ignoreCase, javax.swing.text.Segment text, int offset, @NotNull java.lang.CharSequence match)
      Checks if a sub-region of a Segment is equal to a string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • regionMatches

        public static boolean regionMatches​(boolean ignoreCase,
                                            javax.swing.text.Segment text,
                                            int offset,
                                            @NotNull
                                            @NotNull java.lang.CharSequence match)
        Checks if a sub-region of a Segment is equal to a string.
        Parameters:
        ignoreCase - true if case should be ignored, false otherwise
        text - the segment
        offset - the offset into the segment
        match - the string to match
        Returns:
        whether the sub-region matches
      • paintSyntaxLine

        public static int paintSyntaxLine​(@NotNull
                                          @NotNull javax.swing.text.Segment line,
                                          @NotNull
                                          @NotNull java.lang.Iterable<Token> tokens,
                                          @NotNull
                                          @NotNull SyntaxStyles styles,
                                          @NotNull
                                          @NotNull javax.swing.text.TabExpander expander,
                                          @NotNull
                                          @NotNull java.awt.Graphics gfx,
                                          int x,
                                          int y)
        Paints the specified line onto the graphics context. Note that this method modifies the offset and count values of the segment.
        Parameters:
        line - the line segment
        tokens - the token list for the line
        styles - the syntax styles
        expander - the tab expander used to determine tab stops; may be null
        gfx - the graphics context
        x - the x co-ordinate
        y - the y co-ordinate
        Returns:
        the x co-ordinate, plus the width of the painted string