Class EventScriptTab<T>

Type Parameters:
T - the type of the resource
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
AccelerometerScriptTab, AuthChallengeScriptTab, BarcodeScriptTab, BluetoothScriptTab, FormSubmissionScriptTab, KeyEventScriptTab, KeystrokeScriptTab, MenubarScriptTab, MessageHandlerScriptTab, NfcScanScriptTab, PageStartupScriptTab, ScheduledScriptTab, ShutdownInterceptScriptTab, ShutdownScriptTab, StartupScriptTab, TagChangeScriptTab, TimerScriptTab, UpdateScriptTab

public abstract class EventScriptTab<T> extends ResourceEditor<T>
Abstract base class for event script tabs. Extends ResourceEditor to provide common functionality for script editing.
See Also:
  • Field Details

    • scriptEditor

      protected com.inductiveautomation.ignition.designer.gui.tools.ExtensionFunctionPanel scriptEditor
    • scope

      protected int scope
    • editorPanel

      protected JPanel editorPanel
    • enabledCheckbox

      protected JCheckBox enabledCheckbox
    • titleKey

      protected String titleKey
  • Constructor Details

  • Method Details

    • getTabTitle

      public @Nullable String getTabTitle()
      Overrides:
      getTabTitle in class ResourceEditor<T>
    • initEditorPanel

      protected void initEditorPanel()
      Initializes the editor panel with a script editor and enabled checkbox. This is the default behavior for setting up the editor panel. Subclasses can override the `init` method if they require custom initialization and do not wish to call this default setup.
    • addScriptAssistButton

      protected final void addScriptAssistButton()
      Adds getAssistButton() to scriptEditor's toolbar when it is non-null. Subclasses that bypass initEditorPanel() must call this themselves once scriptEditor has been constructed and given a descriptor.
    • getAssistButton

      protected @Nullable AbstractButton getAssistButton()
      The "Ask AI" toolbar button, or null — when the gateway has not enabled the AI agent module, or from an override opting the tab out of assist entirely.

      Called from ResourceEditor.init(T) during the ResourceEditor constructor, so an override cannot read the subclass's own fields. To change what the stock assistant is told, override getAssistContext() or triggerConfigSupport(), which are read when the popup opens; to change anything else about the assistant, override customizeAssistant(DesignerAiContext, EmbeddedAssistantBuilder).

    • customizeAssistant

      protected void customizeAssistant(DesignerAiContext ai, EmbeddedAssistantBuilder assistant)
      Adjusts the assistant behind getAssistButton() before its button is built. assistant arrives fully configured with this tab's agent, host, and the default tag and file @-reference browsers; the default implementation leaves it unchanged. Each builder setter replaces its slot wholesale, so an override that changes the @-browsers supplies the complete list.

      Called during the ResourceEditor constructor, before subclass constructor bodies run, so an override must not read scope or any subclass field. The configuration is fixed for the life of the button.

      Parameters:
      ai - the resolved Designer AI context the button is being built against.
      assistant - the configured builder; call its setters, not its terminal methods.
    • getAssistContext

      protected String getAssistContext()
      Natural-language framing describing what this event script is and how it runs, handed to the assist agent once per session.
    • triggerConfigSupport

      protected @Nullable TriggerConfigSupport<?> triggerConfigSupport()
      This tab's trigger-configuration contract with the assistant, or null — the default, for tabs that have no trigger — to leave the assistant rewriting the script only.

      Called when the assist popup opens and again on every submit, never during ResourceEditor.init(T), so an override may safely read scope and the tab's config panels. Return a fresh TriggerConfigSupport each time rather than a cached field.

    • resourceDescriptor

      protected ResourceDescriptor resourceDescriptor()
      Description copied from class: ResourceEditor
      Returns the resource descriptor for the workspace.

      By default, this implementation supports TabbedResourceWorkspace. Subclasses should override this method to provide a specific resource descriptor for the type of resource they are working with.

      Overrides:
      resourceDescriptor in class ResourceEditor<T>
    • dispose

      public void dispose()
      Provides a default implementation to shut down the python editor. Unregisters the completion provider from the ScriptIndexer to avoid memory leaks or dangling references.
      Overrides:
      dispose in class ResourceEditor<T>
    • getScriptHints

      protected Supplier<PackageTreeNode> getScriptHints()
      Defaults to Gateway hints.
    • getFunctionDescriptor

      protected abstract com.inductiveautomation.ignition.common.script.typing.ExtensionFunctionDescriptor getFunctionDescriptor()
      Returns the descriptor for the extension function associated with this script editor.