Class DesignerContextImpl

java.lang.Object
com.inductiveautomation.ignition.client.model.AbstractClientContext
com.inductiveautomation.ignition.designer.DesignerContextImpl
All Implemented Interfaces:
ClientContext, CommonContext, DesignerContext

public class DesignerContextImpl extends AbstractClientContext implements DesignerContext
  • Constructor Details

  • Method Details

    • getProject

      public DesignerProjectTreeImpl getProject()
      Description copied from interface: ClientContext
      Returns the project that this client is running. Note that this may be null before the client is fully logged in and started, because the context is created before the project is downloaded.
      Specified by:
      getProject in interface ClientContext
      Specified by:
      getProject in interface DesignerContext
    • getLocalizationManager

      public @NonNull DesignerLocalizationManager getLocalizationManager()
      Specified by:
      getLocalizationManager in interface ClientContext
      Specified by:
      getLocalizationManager in interface DesignerContext
    • getNamedQueryManager

      public NamedQueryManager getNamedQueryManager()
      Description copied from interface: ClientContext
      Returns the appropriate named query rpc for the context. In the gateway and client, we only want to use named queries that have been saved. In the designer, we want to use the current version so that reports and bindings can be seen and used for testing before the project is saved.
      Specified by:
      getNamedQueryManager in interface ClientContext
      Returns:
      The correct NamedQueryManager implementation for the scope.
    • getExecutionManager

      public ExecutionManager getExecutionManager()
      Description copied from interface: ClientContext
      Returns the shared task execution manager for this client
      Specified by:
      getExecutionManager in interface ClientContext
    • getModule

      public @Nullable DesignerModuleHook getModule(String id)
      Description copied from interface: ClientContext
      Returns the running hook object that the module with the given ID contributed to this scope. This is the live hook instance, not its Class. Modules use it to reach each other's APIs at runtime.

      The return type is Object because the hook type varies by scope — a ClientModuleHook in a Vision client, a DesignerModuleHook in the Designer (see DesignerContext#getModule(String), which narrows the return type accordingly). Callers narrow the result to an interface the target module publishes for this purpose — pattern matching covers the absent-module case in the same step:

      if (context.getModule(SFCModule.MODULE_ID) instanceof ClientStepRegistryProvider sfc) {
        var registry = sfc.getStepRegistry();
      }
      

      A null result is the usual way to detect that an optional module is unavailable, so account for it unless the module is a hard dependency of yours.

      Specified by:
      getModule in interface ClientContext
      Specified by:
      getModule in interface DesignerContext
      Parameters:
      id - the module ID of the module whose hook you want.
      Returns:
      the module's hook instance, or null if the module is not installed or contributes no hook to this scope.
    • getModules

      public List<ModuleInfo> getModules()
      Description copied from interface: ClientContext
      Retrieve the list of all modules currently loaded in this context
      Specified by:
      getModules in interface ClientContext
    • getLicenseState

      public LicenseState getLicenseState(String moduleId)
      Description copied from interface: CommonContext
      Returns the license state for the given module
      Specified by:
      getLicenseState in interface CommonContext
    • exportResources

      public void exportResources(@NonNull Collection<ResourcePath> resourceIds)
      Description copied from interface: DesignerContext
      Shows the project export window (after doing a commit) with the given resource IDs checked.
      Specified by:
      exportResources in interface DesignerContext
      Parameters:
      resourceIds - Collection of ProjectResourceIds. Not null, but may be empty.
    • createExpressionFunctionFactory

      public FunctionFactory createExpressionFunctionFactory()
      Specified by:
      createExpressionFunctionFactory in class AbstractClientContext
    • fireScriptManagerInitialized

      public void fireScriptManagerInitialized()
    • getResourceCategoryKey

      public String getResourceCategoryKey(@NonNull ResourceId id)
    • getResourceCategoryKey

      public String getResourceCategoryKey(@NonNull ResourcePath resourcePath)
    • getResourceDisplayName

      public String getResourceDisplayName(@NonNull ResourceId id)
    • getResourceDisplayName

      public String getResourceDisplayName(@NonNull ResourcePath path)
    • getResourceIcon

      public Icon getResourceIcon(@NonNull ResourcePath path)
    • getModuleIcon

      public @Nullable Icon getModuleIcon(@NonNull String moduleId)
    • registerResourceWorkspace

      public void registerResourceWorkspace(@NonNull ResourceWorkspace workspace)
      Description copied from interface: DesignerContext
      Registers a new ResourceWorkspace, which is a main editing area for the designer. The workspace has menus and toolbars associated with it that become visible when the workspace is focused.
      Specified by:
      registerResourceWorkspace in interface DesignerContext
      Parameters:
      workspace - The ResourceWorkspace to register with the designer
    • getResourceMetaRegistry

      public @NonNull DesignerResourceMetaRegistry getResourceMetaRegistry()
      Description copied from interface: DesignerContext
      Returns the registry of resource type metadata contributed by installed modules.
      Specified by:
      getResourceMetaRegistry in interface DesignerContext
    • getAiContext

      public @NonNull Optional<DesignerAiContext> getAiContext()
      Description copied from interface: DesignerContext
      Returns the Designer's AI context — exposes toolbar-button factories for inline chat popups and the currently selected model provider. Only present when the AI module is installed and AI is enabled in this Designer.
      Specified by:
      getAiContext in interface DesignerContext
    • getSearchProviders

      public @NonNull List<SearchProvider> getSearchProviders()
      Description copied from interface: DesignerContext
      Get the registered SearchProviders.
      Specified by:
      getSearchProviders in interface DesignerContext
      Returns:
      Not null.
    • getSearchProvider

      public @Nullable SearchProvider getSearchProvider(String id)
      Specified by:
      getSearchProvider in interface DesignerContext
    • registerClientPermissions

      public void registerClientPermissions(Map<String,String> bundleMap)
      Description copied from interface: DesignerContext
      Register id-bundlekey pairs to limit client permissions
      Specified by:
      registerClientPermissions in interface DesignerContext
      Parameters:
      bundleMap - Map of ids to bundlekeys. Not null.
    • getClientPermissionBundleKeys

      public @NonNull Map<String,String> getClientPermissionBundleKeys()
      Specified by:
      getClientPermissionBundleKeys in interface DesignerContext
    • registerSearchProvider

      public void registerSearchProvider(@NonNull SearchProvider provider)
      Description copied from interface: DesignerContext
      Registers a search provider that will be exposed through the find/replace system.
      Specified by:
      registerSearchProvider in interface DesignerContext
    • getFrame

      public @NonNull IgnitionDesigner getFrame()
      Description copied from interface: DesignerContext
      Returns the owning frame of the designer. Handy for dialog parents
      Specified by:
      getFrame in interface DesignerContext
    • getCutAction

      public @NonNull Action getCutAction()
      Specified by:
      getCutAction in interface DesignerContext
    • getCopyAction

      public @NonNull Action getCopyAction()
      Specified by:
      getCopyAction in interface DesignerContext
    • getPasteAction

      public @NonNull Action getPasteAction()
      Specified by:
      getPasteAction in interface DesignerContext
    • getDeleteAction

      public @NonNull Action getDeleteAction()
      Specified by:
      getDeleteAction in interface DesignerContext
    • getRenameAction

      public @NonNull Action getRenameAction()
      Specified by:
      getRenameAction in interface DesignerContext
    • getTagManager

      public ClientTagManager getTagManager()
      Description copied from interface: CommonContext
      Returns the manager that provides access to Ignition's tag system.
      Specified by:
      getTagManager in interface ClientContext
      Specified by:
      getTagManager in interface CommonContext
    • addBeanInfoSearchPath

      public void addBeanInfoSearchPath(@NonNull String packageName)
      Description copied from interface: DesignerContext
      Adds the given fully-qualified path name to the Introspector's BeanInfo search path. BeanInfos can be important for not only visual beans, but for controlling serialization.
      Specified by:
      addBeanInfoSearchPath in interface DesignerContext
      Parameters:
      packageName - fully-qualified path name. Not null.
    • createSerializer

      public XMLSerializer createSerializer()
      Description copied from interface: DesignerContext
      Creates a new XML serializer that has been configured by all installed modules for custom serialization delegates
      Specified by:
      createSerializer in interface DesignerContext
      Returns:
      Not null.
    • createDeserializer

      public XMLDeserializer createDeserializer()
      Description copied from interface: CommonContext
      Returns an instance of the XMLDeserializer that can be used to deserialize project resources. Note that this is the only safe way to obtain an instance of XMLDeserializer, because the context will pass the new deserializer around to all loaded modules, giving them a chance to initialize any custom deserialization deletes on it first.
      Specified by:
      createDeserializer in interface CommonContext
    • getStatusBar

      public StatusBar getStatusBar()
      Description copied from interface: DesignerContext
      The StatusBar at the bottom of the Designer can be used to display temporary messages and for adding always-present little components that appear in the bottom-right
      Specified by:
      getStatusBar in interface DesignerContext
      Returns:
      Not null.
    • getResourceEditManager

      public DesignerResourceEditManager getResourceEditManager()
      Description copied from interface: DesignerContext
      Resource edit manager
      Specified by:
      getResourceEditManager in interface DesignerContext
    • shutdown

      public void shutdown()
      Overrides:
      shutdown in class AbstractClientContext
    • getRootPaneContainer

      public RootPaneContainer getRootPaneContainer()
      Description copied from interface: ClientContext
      Returns the RootPaneContainer that is currently the owner of the client
      Specified by:
      getRootPaneContainer in interface ClientContext
    • getProjectBrowserRoot

      public @NonNull ProjectBrowserRoot getProjectBrowserRoot()
      Description copied from interface: DesignerContext
      Returns the root node of the project browser tree, so that modules may add their own nodes.
      Specified by:
      getProjectBrowserRoot in interface DesignerContext
      See Also:
    • deserialize

      public Object deserialize(byte[] data, org.apache.log4j.Logger log) throws SerializationException
      Description copied from interface: ClientContext
      Convenience function to deserialize a gzipped byte array into a single object. If multiple objects are found, they will be discarded. Warnings are logged to the given logger. If data is null or empty, null is returned.
      Specified by:
      deserialize in interface ClientContext
      Throws:
      SerializationException
    • addPropertyEditor

      public void addPropertyEditor(@NonNull Class<? extends AbstractPropertyEditorPanel> pageClass)
      Description copied from interface: DesignerContext
      Adds a property editor page that will be incorporated into the Designer's project property editing system. This class will be instantiated the first time that the property editor is displayed, and must have either a nullary constructor or a constructor that takes a DesignerContext.

      The Property Editing framework is designed around the idea that modules will store properties in opaquely xml-serialized project resources which can be uniquely identified by their module ID and resource type. The property editing UI will handle the de/serialization and project syncing tasks so that the property editor pages can simply focus on UI.

      Specified by:
      addPropertyEditor in interface DesignerContext
    • getScriptManager

      public ScriptManager getScriptManager()
      Description copied from interface: CommonContext
      Returns the ScriptManager that can be used to execute Python scripts.
      Specified by:
      getScriptManager in interface CommonContext
    • getDockingManager

      public @NonNull com.jidesoft.docking.DockingManager getDockingManager()
      Description copied from interface: DesignerContext
      Returns the JIDE DockingManager for the Designer
      Specified by:
      getDockingManager in interface DesignerContext
    • getToolbarManager

      public @NonNull com.jidesoft.action.DockableBarManager getToolbarManager()
      Description copied from interface: DesignerContext
      Returns the JIDE dockable toolbar manager
      Specified by:
      getToolbarManager in interface DesignerContext
    • getTagEditor

      public @NonNull TagEditor getTagEditor()
      Description copied from interface: DesignerContext
      Returns the TagEditorPanel that can be used to edit/add Tags
      Specified by:
      getTagEditor in interface DesignerContext
    • getTagBrowser

      public @NonNull com.inductiveautomation.ignition.designer.tags.frame.TagBrowserFrame getTagBrowser()
      Description copied from interface: DesignerContext
      Returns the TagBrowserPanel that can be used to select Tags
      Specified by:
      getTagBrowser in interface DesignerContext
    • getOPCBrowser

      public @NonNull OPCBrowserPanel getOPCBrowser()
      Description copied from interface: DesignerContext
      Returns the OPCBrowserPanel that can be used to browse and import OPC items
      Specified by:
      getOPCBrowser in interface DesignerContext
    • getQueryBrowserPanel

      public @NonNull QueryBrowser getQueryBrowserPanel()
      Description copied from interface: DesignerContext
      Returns the DB query browser tool
      Specified by:
      getQueryBrowserPanel in interface DesignerContext
    • editResourceDocs

      public void editResourceDocs(@NonNull Resource resource)
      Description copied from interface: DesignerContext
      Opens up the resource notes editor for the given project resources
      Specified by:
      editResourceDocs in interface DesignerContext
    • getDesignerPrefs

      public @NonNull PersistentProperties getDesignerPrefs()
      Description copied from interface: DesignerContext
      Returns a PersistentProperties file that will be stored on a per-user basis for "persistent" but not project-encapsulated preferences
      Specified by:
      getDesignerPrefs in interface DesignerContext
    • canEditResourceProtection

      public boolean canEditResourceProtection()
      Description copied from interface: DesignerContext
      Checks whether or not the current logged in user can edit the protection bits of project resources.
      Specified by:
      canEditResourceProtection in interface DesignerContext
    • addLegacyScriptNode

      public void addLegacyScriptNode()
      Adds the Legacy Script project node for pre-7.7 script modules that have been imported by the user.
    • showError

      protected void showError(String message)
    • showError

      protected void showError(Exception e)
    • showError

      protected void showError(String message, Exception e)
    • getLogger

      protected LoggerEx getLogger()
    • newProjectResourceListener

      protected ResourceListener newProjectResourceListener()
      Make a custom resource listener so we can update the script playground with any project script changes
      Overrides:
      newProjectResourceListener in class AbstractClientContext