Class NbResourceUI

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

public class NbResourceUI extends DefaultResourceUI
NetBeans-specific implementation of ResourceUI.

This strategy leverages NetBeans native APIs for high-fidelity navigation and visualization within the IDE. It provides the NetBeansTextResourceViewer for 100% IDE fidelity (line numbers, folds, errors).

Author:
anahata
  • Constructor Details

    • NbResourceUI

      public NbResourceUI()
  • 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.

      Implementation details: Returns a native NetBeansTextResourceViewer for textual resources, providing real 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.
    • createHandlePanel

      public JPanel createHandlePanel(Resource resource, AgiPanel agiPanel)
      Creates a specialized metadata panel for the resource's handle.

      Implementation details: Provides specialized metadata panels based on the handle's connectivity type.

      Implementation details: Provides specialized metadata panels based on the handle's connectivity type.

      Specified by:
      createHandlePanel in interface ResourceUI
      Overrides:
      createHandlePanel in class DefaultResourceUI
      Parameters:
      resource - The resource instance.
      agiPanel - The parent AgiPanel.
      Returns:
      A JPanel configured to show handle-specific attributes.
    • 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.

      Implementation details: Injects IDE-specific 'Open' and 'Select' 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.

      Implementation details: Uses the NetBeans OpenCookie to open physical files in the native code editor.

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

      public void openUri(String uriString)
      Opens a generic URI using the host environment's preferred method.
      Specified by:
      openUri in interface ResourceUI
      Overrides:
      openUri in class DefaultResourceUI
      Parameters:
      uriString - The URI string to open.
    • 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.

      Implementation details: Uses the ASI IDE tool to focus the resource in the Projects window.

      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.