Class Language

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Language extends GObject

Represents a syntax highlighted language.

A GtkSourceLanguage represents a programming or markup language, affecting syntax highlighting and context classes.

Use LanguageManager to obtain a GtkSourceLanguage instance, and Buffer.setLanguage(Language) to apply it to a Buffer.

  • Constructor Details

    • Language

      public Language(MemorySegment address)
      Create a Language instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Language

      public Language()
      Create a new Language.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Language class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected Language asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getGlobs

      public @Nullable String @Nullable [] getGlobs()

      Returns the globs associated to this language.

      This is just an utility wrapper around getMetadata(String) to retrieve the "globs" metadata property and split it into an array.

      Returns:
      a newly-allocated null terminated array containing the globs or null if no globs are found. The returned array must be freed with g_strfreev().
    • getHidden

      public boolean getHidden()
      Returns whether the language should be hidden from the user.
      Returns:
      true if the language should be hidden, false otherwise.
    • getId

      public String getId()

      Returns the ID of the language.

      The ID is not locale-dependent.The returned string is owned by this Language and should not be freed or modified.

      Returns:
      the ID of language.
    • getMetadata

      public @Nullable String getMetadata(String name)
    • getMimeTypes

      public @Nullable String @Nullable [] getMimeTypes()

      Returns the mime types associated to this language.

      This is just an utility wrapper around getMetadata(String) to retrieve the "mimetypes" metadata property and split it into an array.

      Returns:
      a newly-allocated null terminated array containing the mime types or null if no mime types are found. The returned array must be freed with g_strfreev().
    • getName

      public String getName()

      Returns the localized name of the language.

      The returned string is owned by this Language and should not be freed or modified.

      Returns:
      the name of language.
    • getSection

      public String getSection()

      Returns the localized section of the language.

      Each language belong to a section (ex. HTML belongs to the Markup section). The returned string is owned by this Language and should not be freed or modified.

      Returns:
      the section of language.
    • getStyleFallback

      public @Nullable String getStyleFallback(String styleId)
      Returns the ID of the style to use if the specified styleId is not present in the current style scheme.
      Parameters:
      styleId - a style ID.
      Returns:
      the ID of the style to use if the specified styleId is not present in the current style scheme or null if the style has no fallback defined. The returned string is owned by the this Language and must not be modified.
    • getStyleIds

      public @Nullable String @Nullable [] getStyleIds()
      Returns the ids of the styles defined by this language.
      Returns:
      a newly-allocated null terminated array containing ids of the styles defined by this this Language or null if no style is defined. The returned array must be freed with g_strfreev().
    • getStyleName

      public @Nullable String getStyleName(String styleId)
      Returns the name of the style with ID styleId defined by this language.
      Parameters:
      styleId - a style ID.
      Returns:
      the name of the style with ID styleId defined by this this Language or null if the style has no name or there is no style with ID styleId defined by this language. The returned string is owned by the this Language and must not be modified.
    • builder

      public static Language.Builder<? extends Language.Builder> builder()
      A Language.Builder object constructs a Language with the specified properties. Use the various set...() methods to set properties, and finish construction with Language.Builder.build().
      Returns:
      the builder object