Class SNTCommandFinder

java.lang.Object
sc.fiji.snt.gui.SNTCommandFinder

public class SNTCommandFinder extends Object
Implements SNT's Command Palette. An older version of this code is used by Fiji's Script Editor. In the future, should move to a common library to avoid this kind of duplication.
  • Constructor Details

    • SNTCommandFinder

      public SNTCommandFinder(SNTUI sntui)
      Constructs a new SNTCommandFinder for the specified SNTUI instance.
      Parameters:
      sntui - the SNTUI instance to associate with this command finder
    • SNTCommandFinder

      public SNTCommandFinder(Viewer3D viewer3D)
      Constructs a new SNTCommandFinder for the specified Viewer3D instance.
      Parameters:
      viewer3D - the Viewer3D instance to associate with this command finder
  • Method Details

    • dispose

      public void dispose()
      Disposes of this command finder and its associated resources.
    • setRecorder

      public void setRecorder(ScriptRecorder recorder)
      Sets the script recorder for this command finder.
      Parameters:
      recorder - the ScriptRecorder instance to use for recording commands
    • runCommand

      public void runCommand(String actionIdentifier)
    • registerKeywords

      public void registerKeywords(String label, List<String> path, List<String> keywords, AbstractAction executeAction, AbstractAction revealAction)
      Registers a pseudo entry that isn't backed by any UI button. Useful for surfacing tabs, panels, or actions that have no immediate clickable action.

      The entry survives subsequent index rebuilds and matches against the supplied keywords, label, and path.

      Parameters:
      label - primary entry name (matched against id; also displayed in the palette)
      path - parent-path description shown in the palette, e.g. List.of("PM Tabs")
      keywords - additional searchable terms; any match brings up the entry (e.g., synonyms, related concepts, or names of nested features)
      executeAction - what to run when the entry is invoked
      revealAction - what to run when the entry is invoked in 'reveal' mode. Optional: null allowed.
    • toggleVisibility

      public void toggleVisibility()
      Toggles the visibility of the command finder window.
    • getAccelerator

      public KeyStroke getAccelerator()
      Returns the keyboard shortcut that toggles this palette's visibility.
    • getToggleVisibilityAction

      public Action getToggleVisibilityAction()
      Returns the Action that getAccelerator() triggers (toggle visibility; bring to front and focus the search field if already visible; Shift+accelerator also re-centers the frame).
    • attach

      public void attach(JDialog dialog)
    • getButton

      public JButton getButton(float scaleFactor)
    • getMenuItem

      public AbstractButton getMenuItem(boolean asButton)
    • register

      public void register(AbstractButton button, String... description)
    • register

      public void register(AbstractButton button, List<String> pathDescription)
    • register

      public void register(JPopupMenu menu, List<String> path)
    • getRegisteredComponent

      public AbstractButton getRegisteredComponent(String label)
    • invalidateIndex

      public void invalidateIndex()
      Marks the scraped index stale, e.g., after the tracing canvas's contextual menu (SNTUI.getTracingCanvasPopupMenu()) becomes available or unavailable, such as when a Stream mode materialized crop is created or discarded. The next lazy scrape (palette open, getShortcuts(), etc.) picks up the change; no immediate rescrape happens here
    • setVisible

      public void setVisible(boolean b)
    • getAcceleratorString

      public String getAcceleratorString()