Class IntellijResourceUI

java.lang.Object
uno.anahata.asi.swing.agi.resources.DefaultResourceUI
uno.anahata.asi.intellij.ui.resources.IntellijResourceUI
All Implemented Interfaces:
ResourceUI

public class IntellijResourceUI extends DefaultResourceUI
IntelliJ-specific implementation of ResourceUI.

This strategy leverages IntelliJ native OpenAPI for high-fidelity navigation and visualization within the IDE. It provides IntellijTextResourceViewer for 100% IDE editor fidelity (syntax highlighting, line numbers, folding, error annotators).

Author:
anahata
  • Constructor Details

    • IntellijResourceUI

      public IntellijResourceUI()
  • Method Details

    • createContent

      public JComponent createContent(Resource resource, AgiPanel agiPanel)
      Creates the primary content component for the given resource.

      Implementation details: Dispatches to RSyntaxTextAreaTextResourceViewer for text resources or a custom label for binary/media resources.

      Returns an IntelliJ-native IntellijTextResourceViewer for textual resources, providing authentic IDE editor frames.

      Specified by:
      createContent in interface ResourceUI
      Overrides:
      createContent in class DefaultResourceUI
      Parameters:
      resource - The resource to render.
      agiPanel - The parent AgiPanel.
      Returns:
      The JComponent representing the content view.
    • populateActions

      public void populateActions(JPanel actionContainer, Resource resource, AgiPanel agiPanel)
      Injects host-specific actions into the provided container.

      Implementation details: Injects OS-level actions for physical resources.

      Injects IDE-specific 'Open in Editor' and 'Select in Project' actions for physical resources.

      Specified by:
      populateActions in interface ResourceUI
      Overrides:
      populateActions in class DefaultResourceUI
      Parameters:
      actionContainer - The container (usually a toolbar or header panel).
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
    • open

      public void open(Resource resource, AgiPanel agiPanel)
      Opens the resource in the host environment's preferred viewer or editor.

      Implementation details: Uses Desktop API to open physical or URL resources.

      Opens the physical file in the IntelliJ editor via OpenFileDescriptor.

      Specified by:
      open in interface ResourceUI
      Overrides:
      open in class DefaultResourceUI
      Parameters:
      resource - The resource to open.
      agiPanel - The parent AgiPanel.
    • select

      public void select(Resource resource, AgiPanel agiPanel)
      Selects and highlights the resource in the host environment's navigation component (e.g., Projects tree).

      Implementation details: Standalone mode does not support project-level selection.

      Uses the ASI IDE tool to focus the resource in the Project view.

      Specified by:
      select in interface ResourceUI
      Overrides:
      select in class DefaultResourceUI
      Parameters:
      resource - The resource to select.
      agiPanel - The parent AgiPanel.
    • getPath

      private String getPath(Resource resource)
      Resolves the physical path from the handle for IDE navigation.
      Parameters:
      resource - the resource.
      Returns:
      the absolute path, or null if virtual.