Module jEdit

Class SyntaxUtilities

java.lang.Object
org.gjt.sp.util.SyntaxUtilities

public class SyntaxUtilities extends Object
Syntax utilities that depends on JDK only and syntax package.
Since:
4.3pre13
Version:
$Id: StandardUtilities.java 9871 2007-06-28 16:33:20Z Vampire0 $
Author:
Matthieu Casanova
  • Field Details

  • Method Details

    • getColorHexString

      public static String getColorHexString(Color c)
      Converts a color object to its hex value. The hex value prefixed is with `#', for example `#ff0088'.
      Parameters:
      c - The color object
      Returns:
      the color (it is prefixed with alpha channel)
      Since:
      jEdit 4.3pre13
    • parseColor

      public static Color parseColor(String name, Color defaultColor)
      Since:
      jEdit 4.3pre13
    • getColorMatrixString

      public static String getColorMatrixString(Color[][] matrix)
    • parseColorMatrix

      public static Color[][] parseColorMatrix(String matrix, Color[][] defaultColorMatrix)
      Parses a color matrix of the form "[[red, green], [blue, yellow]]" into a two dimensional array. If the syntax is invalid, the given default value is returned. For the individual colors the same syntax as for parseColor(String, Color) is supported.

      Only rectangular matrices are supported. If the lines of the matrix have different lengths, also the default value is returned.

      Parameters:
      matrix - The color matrix
      defaultColorMatrix - The default value if there was a syntax error
      Since:
      jEdit 5.6
    • parseStyle

      public static SyntaxStyle parseStyle(String str, String family, int size, boolean color, Color defaultFgColor) throws IllegalArgumentException
      Converts a style string to a style object.
      Parameters:
      str - The style string
      family - Style strings only specify font style, not font family
      size - Style strings only specify font style, not font family
      color - If false, the styles will be monochrome
      defaultFgColor - Default foreground color (if not specified in style string)
      Throws:
      IllegalArgumentException - if the style is invalid
      Since:
      jEdit 4.3pre17
    • parseStyle

      public static SyntaxStyle parseStyle(String str, String family, int size, boolean color) throws IllegalArgumentException
      Converts a style string to a style object.
      Parameters:
      str - The style string
      family - Style strings only specify font style, not font family
      size - Style strings only specify font style, not font family
      color - If false, the styles will be monochrome
      Throws:
      IllegalArgumentException - if the style is invalid
      Since:
      jEdit 4.3pre13
    • loadStyles

      public static SyntaxStyle[] loadStyles(String family, int size)
      Loads the syntax styles from the properties, giving them the specified base font family and size.
      Parameters:
      family - The font family
      size - The font size
      Since:
      jEdit 4.3pre13
    • loadStyles

      public static SyntaxStyle[] loadStyles(String family, int size, boolean color)
      Loads the syntax styles from the properties, giving them the specified base font family and size.
      Parameters:
      family - The font family
      size - The font size
      color - If false, the styles will be monochrome
      Since:
      jEdit 4.3pre13