Drawing Hands by M.C. Escher (1948)

Jeff Mesnil


Console DOM for Eclipse Monkey script

On March 21st, 2006 in eclipse

I wrote a simple DOM to write message to Eclipse console from a Monkey Script.

I have not yet created an update site for it so you have do download it and install it in your plugins directory manually.
It provides a out variable that you can use to write to a console.

Here is the mandatory “Hello, World” example:

--- Came wiffling through the eclipsey wood ---
/*
 * Menu: Console > Hello
 * Kudos: Jeff Mesnil
 * License: EPL 1.0
 * DOM: http://jmesnil.net/eclipse/updates/net.jmesnil.doms 
 */

function main() {
  out.print("Hello, ").println("World");
 }

--- And burbled as it ran! ---

and its output

Hello, World console screenshot

4 Responses to “Console DOM for Eclipse Monkey script”

  1. Jon Crater Says:

    Jeff,

    I ran across your site while digging around for monkey scripts. I downloaded the plugins from the update site, but when I run the sample, it throws the error “The script test.em requires this missing DOM plugin: org.eclipse.dash.doms”

    I’ve scoured the internet and I can’t find this anywhere. I know this is off-topic, but I thought you may know. Here’s the script I’m running,

    Thanks in advance,

    Jon

    /*
    * Menu: Maven > Make Maven Targets Derived
    * Kudos: Donnchadh
    * License: EPL 1.0
    * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.dash.doms
    */

    function main() {
    var files = resources.filesMatching(”.*/pom\.xml”);
    var targetFolder;

    for each( file in files ) {
    if (targetFolder = file.eclipseObject.parent.findMember(”target”)) {
    targetFolder.setDerived(true);
    }
    }
    }

  2. jmesnil Says:

    Hi Jon,

    since the time I wrote this script, the DOM URL has changed.
    In your script, I replaced:

    * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.dash.doms
    

    by

    * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
    

    and it worked as expected.

  3. Jon Crater Says:

    Beautiful! Thanks a ton. I’m not sure why I couldn’t find this documented anywhere. Is it?

    Jon

  4. jmesnil Says:

    The only place I saw this DOM was in the script examples generated by Eclipse Monkey.

    As an aside, this DOM directive is really misleading: it is not the real URL of a plug-in.
    It is composed in fact of 2 things:

    DOM: <update site url>/<plug-in id>
    

    In the case of http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript, that means that Eclipse Monkey will connect to the update site http://download.eclipse.org/technology/dash/update/ and asks the user to choose among the features listed by the update site (in the site.xml file) the one which contains the org.eclipse.eclipsemonkey.lang.javascript plug-in (in that case, the org.eclipse.eclipsemonkey feature).


    jeff