Dimitri Missoh
enthusiastic technologist and problem solver

May 22nd, 2008

Eclipse, let groove it! Eclipse scripting and rapide prototyping


Warning: fsockopen() [function.fsockopen]: unable to connect to swarmy.free.fr:80 in /mnt/105/sda/5/a/swarmy/wordpress/wp-includes/class-snoopy.php on line 1142

A few days ago I’ve tried out the Groovy Monkey project. It is amazing to see how a few lines of code can be used to write powerful scripts for eclipse. The installation of this plug-in is quite straightforward. I’m using the 3.4M7 build of eclipse and use the new dropins location available from within eclipse to install the groovy monkey plug-in. Here are the necessary steps to install it:

  1. Go to the source forge site of the project and download the last build of the groovy monkey project (e.g. groovyMonkey.zip).
  2. Create a new folder e.g. with the name groovyMonkey in the dropins folder of your eclipse installation directory.
  3. Unzip the content of the downloaded file (e.g. groovyMonkey.zip) into the groovyMonkey folder previously created
  4. Restart your IDE.

Using the dropins folder to install plug-ins
The plug-in is delivered with some nice sample scripts. Try them!

Here is my very first script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
* Script-Path: /GroovyMonkeyScripts/monkey/MyFirst.gm
* Kudos:
* License: EPL 1.0
* Job: UIJob
* DOM: http://groovy-monkey.sourceforge.net/update/plugins/net.sf.groovyMonkey.dom
*/
def viewsString = ""
def views = window.getActivePage().getViews()
for(view in views){
   viewsString = viewsString + 'View: ' + view.getTitle() + '\n'
}
def message = 'Enumerate all views actually opened in your workbench:\n\n' + "$viewsString"
org.eclipse.jface.dialogs.MessageDialog.openInformation( window.getShell(), 'Active Views', "$message")

Other internet ressources related to Groovy Monkey: