Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Debug listener



The DebugListener is an interface which is used to manage the Debug session.

Attaching the listener to the script wrapper

To attach the listener to the wrapper, you must perform DebuggingWrapper.setDebugListener(DebugListener). For example:
      ScriptWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() {
      };
      SwingDebugScriptWindow debugWindow = new SwingDebugScriptWindow(20, 20);
      wrapper.setDebugListener(debugWindow);               
The listener will be used for all Debug sessions.

Debug listener API

The Debug listener has the following API:

public class DebugListener


Modifier and Type Method and Description
void endSession()
Called when the session has ended
void setDebugSession(DebugSession session)
Set the debug session
void step(Step step)
Called for each step if the debugger must stop for this step

The DebugListener does not depend on the script interface, nor on the scripting language.

Managing exceptions

If the Debug listener implements the ScriptExceptionListener interface, the exceptions encountered during the Debug session will be managed by the listener.

Logging

If the Debug listener implements the ScriptLogger interface, logging during the Debug session will be managed by the listener.

Swing debug listener


By default you have to implement the DebugListener interface, but the SwingDebugScriptWindow is a Swing component which implements it. It also implements both the ScriptExceptionListener and ScriptLogger interfaces.

Categories: api | debugging

Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence