Groovy Monkey is a dynamic scripting tool for the Eclipse Platform that enables you to automate tasks, explore the Eclipse API and engage in rapid prototyping. In fact, I think that if you are working on automating tasks in Eclipse or doing Plugin development in general, this tool is one for you. Groovy Monkey can allow you to try out code and do rapid prototyping without the overhead of deploying a plugin or creating a seperate runtime instance.
Groovy Monkey is based on the Eclipse Jobs API, which enables you to monitor the progress in the platform seemlessly and allows you to write your scripts so that users can cancel them midway. Groovy Monkey is also based on the Bean Scripting Framework (BSF) so that you can write your Groovy Monkey scripts in a number of languages ( particularly Groovy ). In fact you can write in Groovy, Beanshell, Ruby or Python. The project update site is located at the Groovy-Monkey SourceForge site ( update sites: Eclipse v3.2 or Eclipse v3.1.2 ). Direct download of Groovy Monkey directly goto http://sourceforge.net/project/showfiles.php?group_id=168501
Eclipse Version compatibility
Java Version compatibility
Addition one: metadata keywords
LANG metadata keyword
First, there is a new metadata keyword called LANG, which as is implied, determines what scripting language you wish to use. Here is an example of an Groovy Monkey base example ported to Groovy:
Notice the LANG tag, that is all there is to that. There is also a New Groovy Monkey Script wizard available that has the
legal values in pulldown menus.
Job metadata keyword
The Job metadata tag allows you to specify what kind of Eclipse Job that your Groovy Monkey script will be run in. By default it is set to Job, but UIJob and WorkspaceJob are also available. In Eclipse it is best to run almost all of your code from outside the UI Thread so UIJob is not recommended. To enable you to access UI elements from within your script there is a Runner DOM that enables your script to pass a Runnable object that can be called from the asyncExec() or syncExec() methods. For Groovy the JFace DOM allows you to pass a Closure directly to be invoked from either asyncExec() or syncExec().
Exec-Mode metadata keyword
The Exec-Mode metadata keyword allows you to specify whether the script should be run in the background (default ) or foreground. The foreground mode has Eclipse directly pop up a modal dialog box that shows the user the progress of the script, the background node does not.
Include metadata keyword
The Include metadata keyword allows you to specify a resource in your workspace and to directly add it to the classloader of your Groovy Monkey script. Examples would obviously include jar files or directories.
Include-Bundle metadata keyword
The Include-Bundle metadata keyword allows you to have an installed bundle be directly added to the classloader of your Groovy Monkey script.
Addition two: Outline view
Secondly, the outline view is populated showing the binding variable names and types with their publicly available methods and fields. This can be useful since the DOMs are loaded on your eclipse ide as plugins and not in your workspace view. Even if you were to load in the DOMs into your workspace, there is still a great deal of switching that must be done.
You can double click on a type in the outline view and have it open the source directly in your editor, if you have included external plugins in your Java search path.
There is also an "Installed DOMs" view that shows the installed DOM plugins currently in your Eclipse workbench. The editor also includes a right click command to display a dialog that lists the and will install available DOMs to your script.
Addition three: Groovy SWT and Launch Manager DOMs
Thirdly, there are new DOMs that are located on the update site that include direct access to a console for output, enable you to script your launch configurations together and a wrapper for the Groovy SWT project as a DOM.
Here is an example of a script, copied from the examples given in Groovy-SWT, ported into Groovy Monkey. The Groovy-SWT DOM is now included by default when you have the net.sf.groovyMonkey.groovy fragment installed. The net.sf.groovyMonkey.groovy fragment contains Groovy Monkey's support for the Groovy language.
Here is an example of a script that uses the Launch Configuration Manager DOM along with the JFace/SWT DOM and the Console output DOM. It prints out the list of all your available launch configurations and allows you to select which ones you wish to string together.