Class ScriptUtil

java.lang.Object
org.yamcs.studio.script.ScriptUtil
Direct Known Subclasses:
ScriptUtil

public class ScriptUtil extends Object
The utility class to facilitate BOY script programming.
  • Constructor Details

    • ScriptUtil

      public ScriptUtil()
  • Method Details

    • openOPI

      public static void openOPI(AbstractBaseEditPart widget, String opiPath, int target, MacrosInput macrosInput)
      Open an OPI.
      Parameters:
      widget - the widget to which the script is attached.
      opiPath - the path of the OPI. It can be either an absolute path or a relative path to the Display file of the widget.
      target - target place of the new OPI. 0: new tab; 1: replace current one; 2: new window; 3: view on left; 4: view on right; 5: view on top; 6: view on bottom; 7: detached view; 8: new shell
      macrosInput - the macrosInput. null if no macros needed.
    • closeCurrentOPI

      public static void closeCurrentOPI()
      Close current active OPI.
    • closeAssociatedOPI

      public static void closeAssociatedOPI(AbstractBaseEditPart widget)
      Close OPI associated with the provided widget.
    • executeEclipseCommand

      public static final void executeEclipseCommand(String commandId, String[] parameters)
      Execute an Eclipse command with optional parameters. Any parameters must be defined along with the command in plugin.xml.
      Parameters:
      commandId - the Eclipse command id
      parameters - a list of further String arguments alternating key, value: * executeEclipseCommand("id", ["pkey", "pvalue"])
    • executeEclipseCommand

      public static final void executeEclipseCommand(String commandId)
      Execute an Eclipse command.
      Parameters:
      commandId - the Eclipse command id
    • executeSystemCommand

      public static final void executeSystemCommand(String command, int wait)
      Executing a system or shell command. On Unix, that could be anything in the PATH.

      Several things can happen:

      • Command finishes OK right away
      • Command gives error right away
      • Command runs for a long time, eventually giving error or OK.
      The command executor waits a little time to see if the command finishes, and calls back in case of an error. When the command finishes right away OK or runs longer, we leave it be. Command output will be printed on BOY console.
      Parameters:
      command - Command to run. Format depends on OS.
      wait - Time to wait for completion in seconds
    • execInUI

      public static final void execInUI(Runnable runnable, AbstractBaseEditPart widget)
      Execute a runnable in UI thread.
      Parameters:
      runnable - the runnable to be executed.
      widget - any widget. It is referred to get the UI thread.
    • getBOYVersion

      @Deprecated public static final org.osgi.framework.Version getBOYVersion()
      Deprecated.