Eclipse Monkey is a dynamic scripting tool for the automation of routine programming tasks. Monkey scripts are little Javascript programs using either the Eclipse APIs or custom Monkey DOMs.
If you're reading this, Eclipse Monkey is already installed.
(If you're reading this outside the Eclipse help system, then Eclipse Monkey might not be installed, in in which case all you need to know is that Eclipse Monkey is an Eclipse feature (a set of plug-ins) that you can install with the Update Manager.)
Eclipse Monkey comes with a few example scripts. To install the examples, use the Create the examples project toolbar button.
Scripts include metadata that specifiy how a script is to be run and (in a future release) additional resources required for successful operation. Metadata consists of keyword values pairs. These are placed in the first comment block of the script. This must be a /* ... */ style comment.
The Menu: metadata tag specifies that this script is to be included in the Monkey menu. If more than one script specifies the same menu item, the menu item will appear more than once.
Scripts manipulate script objects such as strings and arrays, native Java objects including native Eclipse objects, and special DOM objects made specifically to simplify scripting.
Native Java objects can be accessed through their fully qualified class names. Eclipse objects require that the fully qualified name be prepended with the additional name "Packages". Here are some valid scripting expressions that show how this works
java.lang.System.out.println("hello world");
Packages.org.eclipse.jface.dialogs.MessageDialog.openInformation(
window.getShell(),
"Monkey Dialog",
"Hello World"
)
DOM objects appear as globals in the script namespace. Some DOMs are primitively supported, others are supplied by Eclipse Monkey DOM plug-ins. The DOMs available with this release are:
window
-- direct access to the Eclipse IWorkbenchWindow object.
workspace
-- direct acccess to the Eclipse IWorkspace object.
resources
-- indirect access to Eclipse IResources through custom wrappers: Resources, File and Line.
Learn about these DOM through the examples or by reading the source code of the Eclipse Monkey Standard DOMs plug-in.
Eclipse Monkey scripts are short and easily published to blogs, wikis, bugzillas, and all sorts of other places. To publish one (or more) scripts, select the files in the Navigator and use the Copy for Publication... context pop-up menu. Eclipse Monkey provides different publication formats for different destinations, e.g., blogs typically use HTML, wikis use indented text, bugzilla uses straight text, etc. The pop-up menu places the scripts on the clipboard for you to paste into your blog/wiki/bugzilla/whatever.
Eclipse Monkey decorates each script with Jabberwocky-inspired header and footer - you should leave these on as they are necessary for the script retrieval system (described below).
When you see a script that you like - in a blog, on a web page, in an email, or whereever - Eclipse Monkey has a quick and easy retrieval mechanism.