Class BasicContextProvider

java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.context.BasicContextProvider
All Implemented Interfaces:
ContextProvider, PropertyChangeSource, Rebindable
Direct Known Subclasses:
AbstractProjectContextProvider, AbstractProjectContextProvider, AgiCompiledClass, OpenToolWindowsContextProvider, OpenTopComponentsContextProvider, OutputTabsContextProvider, ProjectFilesContextProvider, TerminalTab

public class BasicContextProvider extends BasicPropertyChangeSource implements ContextProvider
A basic, reusable implementation of the ContextProvider interface that provides the foundational logic for hierarchical context management.

It extends BasicPropertyChangeSource to support reactive UI bindings, ensuring that changes to the provider's state are immediately reflected in the context tree and details panels.

Author:
anahata
  • Field Details

    • id

      private final String id
      The unique identifier for this provider.
    • name

      private final String name
      The human-readable name of this provider.
    • description

      private final String description
      A detailed description of this provider's purpose.
    • providing

      private boolean providing
      Whether this provider is currently active. Defaults to true.
    • parent

      protected ContextProvider parent
      The parent provider in the hierarchy.
    • children

      protected final List<ContextProvider> children
      The list of immediate child providers.
  • Constructor Details

    • BasicContextProvider

      public BasicContextProvider()
  • Method Details

    • getChildrenProviders

      public List<ContextProvider> getChildrenProviders()
      Gets the list of immediate child context providers.
      Specified by:
      getChildrenProviders in interface ContextProvider
      Returns:
      The list of children, or an empty list if none.
    • getParentProvider

      public ContextProvider getParentProvider()
      Gets the parent context provider in the hierarchy, if any.
      Specified by:
      getParentProvider in interface ContextProvider
      Returns:
      The parent provider, or null if this is a root provider.
    • setParentProvider

      public void setParentProvider(ContextProvider parent)
      Sets the parent context provider for this instance.
      Specified by:
      setParentProvider in interface ContextProvider
      Parameters:
      parent - The parent provider.
    • getAgi

      public Agi getAgi()
      Gets the parent AGI session this context provider is registered under.

      Resolves the parent AGI session by delegating up the context provider hierarchy.

      Specified by:
      getAgi in interface ContextProvider
      Returns:
      The active parent AGI session, or null if it cannot be resolved.