Package dev.turboism.sdk.ui.context
Record Class ContextMenuRegistry.ContextMenuEntry
java.lang.Object
java.lang.Record
dev.turboism.sdk.ui.context.ContextMenuRegistry.ContextMenuEntry
- Record Components:
kind- entry structureid- non-blank entry identitylabel- required for items and submenus; empty for separatorsactionId- required for items; empty otherwisechildren- immutable submenu children; empty for items and separatorsplacement- 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 Summary
ConstructorsConstructorDescriptionContextMenuEntry(ContextMenuRegistry.EntryKind kind, String id, String label, String actionId, List<ContextMenuRegistry.ContextMenuEntry> children, ContextMenuRegistry.Placement placement) Validates the entry's kind-specific content and snapshots child entries. -
Method Summary
Modifier and TypeMethodDescriptionactionId()Returns the value of theactionIdrecord component.children()Returns the value of thechildrenrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.Creates an item at the end of its target surface.item(String id, String label, String actionId, ContextMenuRegistry.Placement placement) Creates an item at an explicit placement.kind()Returns the value of thekindrecord component.label()Returns the value of thelabelrecord component.Returns the value of theplacementrecord component.Creates a separator at the end of its target surface.separator(String id, ContextMenuRegistry.Placement placement) Creates a separator at an explicit placement.submenu(String id, String label, List<ContextMenuRegistry.ContextMenuEntry> children) Creates a submenu at the end of its target surface.submenu(String id, String label, List<ContextMenuRegistry.ContextMenuEntry> children, ContextMenuRegistry.Placement placement) Creates a submenu at an explicit placement.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ContextMenuEntry
public ContextMenuEntry(ContextMenuRegistry.EntryKind kind, String id, String label, String actionId, List<ContextMenuRegistry.ContextMenuEntry> children, ContextMenuRegistry.Placement placement) Validates the entry's kind-specific content and snapshots child entries.- Parameters:
kind- entry structureid- non-blank entry identitylabel- label as required bykindactionId- action ID as required bykindchildren- submenu children as required bykindplacement- non-null entry placement- Throws:
NullPointerException- if a required component isnullIllegalArgumentException- if kind-specific structure is invalid
-
-
Method Details
-
item
Creates an item at the end of its target surface.- Parameters:
id- non-blank entry identitylabel- non-blank item labelactionId- 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 identitylabel- non-blank item labelactionId- non-blank plugin action identifierplacement- entry placement- Returns:
- item entry at
placement
-
separator
Creates a separator at the end of its target surface.- Parameters:
id- non-blank separator identity- Returns:
- separator entry placed last
-
separator
public static ContextMenuRegistry.ContextMenuEntry separator(String id, ContextMenuRegistry.Placement placement) Creates a separator at an explicit placement.- Parameters:
id- non-blank separator identityplacement- separator placement- Returns:
- separator entry at
placement
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-
actionId
Returns the value of theactionIdrecord component.- Returns:
- the value of the
actionIdrecord component
-
children
Returns the value of thechildrenrecord component.- Returns:
- the value of the
childrenrecord component
-
placement
Returns the value of theplacementrecord component.- Returns:
- the value of the
placementrecord component
-