java.lang.Object
org.gjt.sp.util.SyntaxUtilities
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Converts a color object to its hex value.static String
getColorMatrixString
(Color[][] matrix) static SyntaxStyle[]
loadStyles
(String family, int size) Loads the syntax styles from the properties, giving them the specified base font family and size.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.static Color
parseColor
(String name, Color defaultColor) static Color[][]
parseColorMatrix
(String matrix, Color[][] defaultColorMatrix) Parses a color matrix of the form"[[red, green], [blue, yellow]]"
into a two dimensional array.static SyntaxStyle
parseStyle
(String str, String family, int size, boolean color) Converts a style string to a style object.static SyntaxStyle
parseStyle
(String str, String family, int size, boolean color, Color defaultFgColor) Converts a style string to a style object.
-
Field Details
-
propertyManager
-
-
Method Details
-
getColorHexString
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
- Since:
- jEdit 4.3pre13
-
getColorMatrixString
-
parseColorMatrix
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 forparseColor(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 matrixdefaultColorMatrix
- 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 stringfamily
- Style strings only specify font style, not font familysize
- Style strings only specify font style, not font familycolor
- If false, the styles will be monochromedefaultFgColor
- 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 stringfamily
- Style strings only specify font style, not font familysize
- Style strings only specify font style, not font familycolor
- If false, the styles will be monochrome- Throws:
IllegalArgumentException
- if the style is invalid- Since:
- jEdit 4.3pre13
-
loadStyles
Loads the syntax styles from the properties, giving them the specified base font family and size.- Parameters:
family
- The font familysize
- The font size- Since:
- jEdit 4.3pre13
-
loadStyles
Loads the syntax styles from the properties, giving them the specified base font family and size.- Parameters:
family
- The font familysize
- The font sizecolor
- If false, the styles will be monochrome- Since:
- jEdit 4.3pre13
-