org.csstudio.opibuilder.scriptUtil
Class ScriptUtil


public class ScriptUtil
extends java.lang.Object

The utility class to facilitate BOY script programming.

Author:
Xihui Chen

Constructor Summary
ScriptUtil()
           
 
Method Summary
static void closeCurrentOPI()
          Close current active OPI.
static void executeEclipseCommand(java.lang.String commandId)
          Execute an Eclipse command.
static void executeSystemCommand(java.lang.String command, int wait)
          Executing a system or shell command.
static void makeElogEntry(java.lang.String filePath)
          Pop up an Elog dialog to make an Elog entry.
static void openOPI(org.csstudio.opibuilder.editparts.AbstractBaseEditPart widget, java.lang.String opiPath, int target, org.csstudio.opibuilder.util.MacrosInput macrosInput)
          Open an OPI.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptUtil

public ScriptUtil()
Method Detail

openOPI

public static final void openOPI(org.csstudio.opibuilder.editparts.AbstractBaseEditPart widget,
                                 java.lang.String opiPath,
                                 int target,
                                 org.csstudio.opibuilder.util.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
macrosInput - the macrosInput. null if no macros needed.

closeCurrentOPI

public static void closeCurrentOPI()
Close current active OPI.


makeElogEntry

public static final void makeElogEntry(java.lang.String filePath)
Pop up an Elog dialog to make an Elog entry.

Parameters:
filePath - path of a file to attach or null. It could be either a local file system file path or a workspace file path. File types that the logbook support depend on implementation but should include *.gif, *.jpg: File will be attached as image.

executeEclipseCommand

public static final void executeEclipseCommand(java.lang.String commandId)
Execute an Eclipse command.

Parameters:
commandId - the command id.

executeSystemCommand

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

Several things can happen:

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