public interface Script { public int computeResult(int value) { } }Let's create a Groovy wrapper:
DebuggingWrapper<Script> wrapper = new GroovyScriptWrapper<Script>() { };Now we will create a
SwingDebugScriptWindow
and set it as a Debug listener of the wrapper:SwingDebugScriptWindow debugWindow = new SwingDebugScriptWindow(20, 20); debugWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); wrapper.setDebugListener(debugWindow);
SwingDebugScriptWindow
we registered will be used for this session.debugWindow.setVisible(true); File file = <the script> wrapper.initializeDebugSession(); wrapper.installScript(file); DebugSession<Script> session = wrapper.createDebugSession(); session.setExecutionMode(ScriptWrapper.MODE_NON_BLOCKING); session.setSessionHook(new SessionHook<Script>() { public void start(Script script) { script.computeResult(10); } }); session.startSession();We will have the following window:
Copyright 2019-2020 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence