ConsoleWaiter.groovy

Provides a wrapper for the console. (Download below)

The run() method launches the console and causes this thread to sleep until the console's window is closed. Allows easy interaction with the objects alive at a given point in an application's execution, similar to a debugger session.

Example 1:

new ConsoleWaiter().run()

Example 2:

def waiter = new ConsoleWaiter()
waiter.console.setVariable("node", node)
waiter.run()

NOTE: I've run across a documented bug. If launching a GUI Swing application (like the Groovy Console) from Eclipse running under Java 6, the JVM is likely to crash. This doesn't happen with Java 5.

I found that if I am editing .groovy scripts, and testing them from the console, that in some cases the .groovy class files get cached and don't get reloaded. I use the following to force the cache to be cleared. (Substitute MyScript with your own .groovy class name.)

MyScript.classLoader.clearCache()

AttachmentSize
ConsoleWaiter.groovy1.08 KB