Package org.gjt.sp.util
Class SyntaxUtilities
- java.lang.Object
-
- org.gjt.sp.util.SyntaxUtilities
-
public class SyntaxUtilities extends java.lang.ObjectSyntax utilities that depends on JDK only and syntax package.- Since:
- 4.3pre13
-
-
Field Summary
Fields Modifier and Type Field Description static IPropertyManagerpropertyManager
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetColorHexString(java.awt.Color c)Converts a color object to its hex value.static java.lang.StringgetColorMatrixString(java.awt.Color[][] matrix)static SyntaxStyle[]loadStyles(java.lang.String family, int size)Loads the syntax styles from the properties, giving them the specified base font family and size.static SyntaxStyle[]loadStyles(java.lang.String family, int size, boolean color)Loads the syntax styles from the properties, giving them the specified base font family and size.static java.awt.ColorparseColor(java.lang.String name, java.awt.Color defaultColor)static java.awt.Color[][]parseColorMatrix(java.lang.String matrix, java.awt.Color[][] defaultColorMatrix)Parses a color matrix of the form"[[red, green], [blue, yellow]]"into a two dimensional array.static SyntaxStyleparseStyle(java.lang.String str, java.lang.String family, int size, boolean color)Converts a style string to a style object.static SyntaxStyleparseStyle(java.lang.String str, java.lang.String family, int size, boolean color, java.awt.Color defaultFgColor)Converts a style string to a style object.
-
-
-
Field Detail
-
propertyManager
public static IPropertyManager propertyManager
-
-
Method Detail
-
getColorHexString
public static java.lang.String getColorHexString(java.awt.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 java.awt.Color parseColor(java.lang.String name, java.awt.Color defaultColor)- Since:
- jEdit 4.3pre13
-
getColorMatrixString
public static java.lang.String getColorMatrixString(java.awt.Color[][] matrix)
-
parseColorMatrix
public static java.awt.Color[][] parseColorMatrix(java.lang.String matrix, java.awt.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 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(java.lang.String str, java.lang.String family, int size, boolean color, java.awt.Color defaultFgColor) throws java.lang.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:
java.lang.IllegalArgumentException- if the style is invalid- Since:
- jEdit 4.3pre17
-
parseStyle
public static SyntaxStyle parseStyle(java.lang.String str, java.lang.String family, int size, boolean color) throws java.lang.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:
java.lang.IllegalArgumentException- if the style is invalid- Since:
- jEdit 4.3pre13
-
loadStyles
public static SyntaxStyle[] loadStyles(java.lang.String family, int size)
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
public static SyntaxStyle[] loadStyles(java.lang.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 familysize- The font sizecolor- If false, the styles will be monochrome- Since:
- jEdit 4.3pre13
-
-