Record Class ThemeDefinition

java.lang.Object
java.lang.Record
org.eclipse.e4.ui.css.swt.theme.ThemeDefinition
Record Components:
id - the id the theme is registered with, including the OS version if the theme declares one
label - the label
osVersion - the OS version the theme declares, or the empty string
dark - whether the theme is dark
stylesheet - the basestylesheeturi as declared
contributor - the name of the contributing bundle
All Implemented Interfaces:
ITheme

public record ThemeDefinition(String id, String label, String osVersion, boolean dark, String stylesheet, String contributor) extends Record implements ITheme
A theme as declared by a theme element of the org.eclipse.e4.ui.css.swt.theme extension point, resolved for the current platform. This is what the theme engine registers, and it can also be read when there is no theme engine.
  • Constructor Details

    • ThemeDefinition

      public ThemeDefinition(String id, String label, String osVersion, boolean dark, String stylesheet, String contributor)
      Creates an instance of a ThemeDefinition record class.
      Parameters:
      id - the value for the id record component
      label - the value for the label record component
      osVersion - the value for the osVersion record component
      dark - the value for the dark record component
      stylesheet - the value for the stylesheet record component
      contributor - the value for the contributor record component
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface ITheme
      Returns:
      the theme id
    • getLabel

      public String getLabel()
      Specified by:
      getLabel in interface ITheme
      Returns:
      the label
    • isDark

      public boolean isDark()
      Description copied from interface: ITheme
      Whether this theme is meant to be used with a dark appearance, as declared by the isDarkTheme attribute of the theme extension. Implementations that do not override this keep the id based classification the platform used before the attribute existed.
      Specified by:
      isDark in interface ITheme
    • readAll

      public static List<ThemeDefinition> readAll()
      Reads the themes contributed for the current platform, in the order of the extension registry. A theme id contributed more than once is returned more than once.
      Returns:
      the themes
    • getPlatformMatches

      public static IConfigurationElement[] getPlatformMatches(IConfigurationElement[] elements)
      Get all elements that have os/ws attributes that best match the current platform.
      Parameters:
      elements - the elements to check
      Returns:
      the best matches, if any
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • label

      public String label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • osVersion

      public String osVersion()
      Returns the value of the osVersion record component.
      Returns:
      the value of the osVersion record component
    • dark

      public boolean dark()
      Returns the value of the dark record component.
      Returns:
      the value of the dark record component
    • stylesheet

      public String stylesheet()
      Returns the value of the stylesheet record component.
      Returns:
      the value of the stylesheet record component
    • contributor

      public String contributor()
      Returns the value of the contributor record component.
      Returns:
      the value of the contributor record component