Class ScriptDebugging


  • public class ScriptDebugging
    extends java.lang.Object
    Controls whether script debugging is enabled. Also allows use of alternative debugger implementations. Only one script debugging system may be in use at a time. This class allows you to install/uninstall different implementations.

    Debugger implementations must provide a class that implements the ScriptDebugging.DebuggerInstaller interface. This class acts as a controller for their implementation: installing and uninstalling on demand and providing high-level access to its features.

    A default debugging engine is included that provides debugging services through a server running within the main application, paired with a separate client application. The initial installer implementation is based on this default implementation, so the built-in debugging system can be started just by calling install().

    Author:
    Chris Jennings
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ScriptDebugging.DebuggerInstaller
      Implemented by classes that can install a script debugger.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ScriptDebugging.DebuggerInstaller getInstaller()
      Returns the current installer.
      static void install()
      Install script debugging using the current installer.
      static boolean isInstalled()
      Returns true if a debugger is currently installed.
      static void prepareToEnterContext()
      If debugging is installed, calls its prepareToEnterContext method.
      static void preprocessScript​(java.lang.String location)
      This method can be called when a script has been discovered but has not yet been run in order to make the debugger aware of the script.
      static void setBreak()
      Set a break as soon as possible by calling the installer's ScriptDebugging.DebuggerInstaller.setBreak() method.
      static void setInstaller​(ScriptDebugging.DebuggerInstaller newInstaller)
      Sets the installer that is used to install a debugger.
      static void setInstaller​(java.lang.String className)
      Sets the installer used to install a debugger by its class name.
      static void uninstall()
      Uninstall script debugging using the current installer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setInstaller

        public static void setInstaller​(ScriptDebugging.DebuggerInstaller newInstaller)
        Sets the installer that is used to install a debugger. If a debugger is currently installed, it will be uninstalled before switching installers. A new debugger is not automatically installed.
        Parameters:
        newInstaller - the installer to use
      • setInstaller

        public static void setInstaller​(java.lang.String className)
        Sets the installer used to install a debugger by its class name.
        Parameters:
        className - the fully qualified name of a class with a no-arg public constructor that implements the ScriptDebugging.DebuggerInstaller interface
        Throws:
        java.lang.IllegalArgumentException - if an installer cannot be created from the class name
      • install

        public static void install()
        Install script debugging using the current installer.
      • uninstall

        public static void uninstall()
        Uninstall script debugging using the current installer.
      • isInstalled

        public static boolean isInstalled()
        Returns true if a debugger is currently installed.
        Returns:
        whether a debugger is installed
      • preprocessScript

        public static void preprocessScript​(java.lang.String location)
        This method can be called when a script has been discovered but has not yet been run in order to make the debugger aware of the script. If supported by the debugger, this allows breakpoints to be set on the script before it is run the first time. This method locates the script automatically; it can handle plug-in root file entries and class map entries, as well as useLibrary sources.
        Parameters:
        location - the resource that contains the script
      • setBreak

        public static void setBreak()
        Set a break as soon as possible by calling the installer's ScriptDebugging.DebuggerInstaller.setBreak() method. If a debugger is not installed, the current debugger will be installed first.
      • prepareToEnterContext

        public static void prepareToEnterContext()
        If debugging is installed, calls its prepareToEnterContext method.