Record Class ContextMenuRegistry.ContextMenuEntry

java.lang.Object
java.lang.Record
dev.turboism.sdk.ui.context.ContextMenuRegistry.ContextMenuEntry
Record Components:
kind - entry structure
id - non-blank entry identity
label - required for items and submenus; empty for separators
actionId - required for items; empty otherwise
children - immutable submenu children; empty for items and separators
placement - non-null entry placement
Enclosing interface:
ContextMenuRegistry

public static record ContextMenuRegistry.ContextMenuEntry(ContextMenuRegistry.EntryKind kind, String id, String label, String actionId, List<ContextMenuRegistry.ContextMenuEntry> children, ContextMenuRegistry.Placement placement) extends Record
Immutable entry tree within a contributed context menu.

Items require an action ID and no children; separators require no content; submenus require a label and non-empty children. Entry action IDs resolve through the contributing plugin's action registry.

  • Constructor Details

  • Method Details

    • item

      public static ContextMenuRegistry.ContextMenuEntry item(String id, String label, String actionId)
      Creates an item at the end of its target surface.
      Parameters:
      id - non-blank entry identity
      label - non-blank item label
      actionId - non-blank plugin action identifier
      Returns:
      item entry placed last
    • item

      public static ContextMenuRegistry.ContextMenuEntry item(String id, String label, String actionId, ContextMenuRegistry.Placement placement)
      Creates an item at an explicit placement.
      Parameters:
      id - non-blank entry identity
      label - non-blank item label
      actionId - non-blank plugin action identifier
      placement - entry placement
      Returns:
      item entry at placement
    • separator

      public static ContextMenuRegistry.ContextMenuEntry separator(String id)
      Creates a separator at the end of its target surface.
      Parameters:
      id - non-blank separator identity
      Returns:
      separator entry placed last
    • separator

      Creates a separator at an explicit placement.
      Parameters:
      id - non-blank separator identity
      placement - separator placement
      Returns:
      separator entry at placement
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • kind

      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • 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
    • actionId

      public String actionId()
      Returns the value of the actionId record component.
      Returns:
      the value of the actionId record component
    • children

      Returns the value of the children record component.
      Returns:
      the value of the children record component
    • placement

      public ContextMenuRegistry.Placement placement()
      Returns the value of the placement record component.
      Returns:
      the value of the placement record component