Class ScriptInstaller

java.lang.Object
sc.fiji.snt.gui.ScriptInstaller
All Implemented Interfaces:
EventListener, MenuKeyListener

public class ScriptInstaller extends Object implements MenuKeyListener
Utility class for discovery of SNT scripts
Author:
Tiago Ferreira
  • Field Details

    • DEMO_SCRIPT

      public static final Pattern DEMO_SCRIPT
      Pattern to match demo scripts (case-insensitive)
    • NON_DEMO_SCRIPT

      public static final Pattern NON_DEMO_SCRIPT
      Pattern to match non-demo scripts (case-insensitive)
  • Constructor Details

    • ScriptInstaller

      public ScriptInstaller(org.scijava.Context context, Component parent)
  • Method Details

    • getScriptsDir

      public File getScriptsDir()
    • getBatchScriptsMenu

      public JMenu getBatchScriptsMenu()
      Returns a UI list of SNT's 'Batch' scripts
    • getScriptsMenu

      public JMenu getScriptsMenu()
      Returns a UI list with all the bundled non-demo SNT scripts
    • getScriptsMenu

      public JMenu getScriptsMenu(Pattern excludePattern, String... directories)
      Returns a UI list with the bundled SNT scripts (specified directories only).
      Parameters:
      excludePattern - the exclusion pattern (e.g., DEMO_SCRIPT). Null allowed.
      directories - the subset of directories (e.g., Analysis, Batch, etc.)
      Returns:
      the scripts menu
    • openScript

      public void openScript(String folder, String name) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • runScript

      public void runScript(String folder, String name) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • newScript

      public static void newScript(String contents, String scriptNameWithExtension)
    • getBoilerplateScript

      public static String getBoilerplateScript(String extension)
    • runScript

      public static boolean runScript(String dir, String file, Map<String,Object> inputMap)
    • runScript

      public static boolean runScript(String scriptPath)
      Runs the specified script known to ScriptService.
      Parameters:
      scriptPath - the script path as registered in ScriptService, (e.g., File/Open_Samples/Comparing_Lengths.ijm or File > Open Samples > Comparing Lengths)
      Returns:
      whether the script was executed