<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jeff Mesnil &#187; eclipse</title>
	<atom:link href="http://jmesnil.net/weblog/category/eclipse/feed/" rel="self" type="application/rss+xml" />
	<link>http://jmesnil.net/weblog</link>
	<description>Thoughts about Java, Web and Software Development</description>
	<lastBuildDate>Thu, 05 Aug 2010 15:49:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>JMX Scripts with Eclipse Monkey</title>
		<link>http://jmesnil.net/weblog/2007/05/23/jmx-scripts-with-eclipse-monkey/</link>
		<comments>http://jmesnil.net/weblog/2007/05/23/jmx-scripts-with-eclipse-monkey/#comments</comments>
		<pubDate>Wed, 23 May 2007 19:53:03 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jmx]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2007/05/23/jmx-scripts-with-eclipse-monkey/</guid>
		<description><![CDATA[Continuing the series about &#8220;writing JMX scripts in a dynamic language&#8221;, after Ruby (part I &#38; II), let&#8217;s do that in JavaScript. Aside of the use of a different scripting language, this example differs completely from the Ruby one by its context of execution: it will be integrated into Eclipse and called directly from its [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing the series about &#8220;writing JMX scripts in a dynamic language&#8221;, after Ruby (<a href="http://jmesnil.net/weblog/2007/03/23/jmx-scripts-using-jruby/">part I</a> &amp; <a href="http://jmesnil.net/weblog/2007/04/03/jmx-scripts-using-jruby-part-ii/">II</a>), let&#8217;s do that in JavaScript.</p>

<p>Aside of the use of a different scripting language, this example differs completely from the Ruby one by its context of execution: it will be integrated into Eclipse and called directly from its user interface (using <a href="http://www.eclipse.org/dash/monkey-help.php?key=installing">Eclipse Monkey</a> as the glue).</p>

<p>The example will:</p>

<ol>
<li>ask graphically the user for a logging level</li>
<li>update all the JVM&#8217;s loggers with this level</li>
<li>display all the loggers of the JVM</li>
</ol>

<p>in 50 lines of code.</p>

<p>This example is simple but it implies several interesting steps:</p>

<ul>
<li>connect to a JMX Server</li>
<li>retrieve a MBean</li>
<li>retrieve value of MBean attributes</li>
<li>invoke operations on the MBean</li>
</ul>

<p>There are many use cases where you have to perform theses steps in repetition. It&#8217;s tedious to do that in a JMX console (e.g. <a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html">jconsole</a> or <a href="http://code.google.com/p/eclipse-jmx/">eclipse-jmx</a>) and most of the time, it is not worth writing a Java application.</p>

<p>These use cases beg to be scripted.</p>

<p><span id="more-151"></span>
We will again use jconsole as our managed java application (see <a href="http://jmesnil.net/weblog/2007/04/03/jmx-scripts-using-jruby-part-ii/">this previous post</a> to start jconsole with all System properties required to manage it remotely).</p>

<p>To run the example:</p>

<ol>
<li>install <a href="http://www.eclipse.org/dash/monkey-help.php?key=installing">Eclipse Monkey</a></li>
<li>Make sure that Eclipse is running on Java 1.5 or above</li>
<li>copy the script just below and save it as <code>logging_change_level.js</code> in the <code>scripts</code> directory of an Eclipse project</li>
<li>click on <code>Scripts &gt; Logging &gt; Change level</code> in Eclipse menu</li>
<li>follow the instruction to install the required DOM

<ul>
<li>only the <code>JMX Monkey</code> feature is required</li>
</ul></li>
<li>restart Eclipse</li>
<li>click on <code>Scripts &gt; Logging &gt; Change level</code></li>
<li>in the dialog, input the logging level
<img src="http://jmesnil.net/img/logging_level_input.png" alt="Dialog to input the logging level" /></li>
<li>all the loggers have been updated with the given level
<img src="http://jmesnil.net/img/logging_results.png" alt="Dialog to display the loggers" /></li>
</ol>

<h3>logging&#95;&#95;change&#95;&#95;level.js</h3>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/*
 * Menu: Logging &gt; Change level
 * DOM: http://eclipse-jmx.googlecode.com/svn/trunk/net.jmesnil.jmx.update/net.jmesnil.jmx.monkey.doms
 */</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   mbsc <span style="color: #339933;">=</span> jmx.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;localhost&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3000</span><span style="color: #009900;">&#41;</span>
   logging <span style="color: #339933;">=</span> mbsc.<span style="color: #660066;">getMBean</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;java.util.logging:type=Logging&quot;</span><span style="color: #009900;">&#41;</span>
&nbsp;
   level <span style="color: #339933;">=</span> ask_level<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   set_all<span style="color: #009900;">&#40;</span>mbsc<span style="color: #339933;">,</span> logging<span style="color: #339933;">,</span> level<span style="color: #009900;">&#41;</span>
   text <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;All loggers are set to &quot;</span> <span style="color: #339933;">+</span> level <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
   text <span style="color: #339933;">+=</span> logger_levels<span style="color: #009900;">&#40;</span>mbsc<span style="color: #339933;">,</span> logging<span style="color: #009900;">&#41;</span>
   show<span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> logger_levels<span style="color: #009900;">&#40;</span>mbsc<span style="color: #339933;">,</span> logging<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #003366; font-weight: bold;">var</span> out <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span>
   <span style="color: #000066; font-weight: bold;">for</span> each<span style="color: #009900;">&#40;</span>loggerName <span style="color: #000066; font-weight: bold;">in</span> logging.<span style="color: #660066;">LoggerNames</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       lvl <span style="color: #339933;">=</span> mbsc.<span style="color: #660066;">invoke</span><span style="color: #009900;">&#40;</span>logging<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;getLoggerLevel&quot;</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#91;</span>loggerName<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;java.lang.String&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       out <span style="color: #339933;">+=</span> loggerName <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; is at &quot;</span> <span style="color: #339933;">+</span> lvl <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #000066; font-weight: bold;">return</span> out
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> set_all<span style="color: #009900;">&#40;</span>mbsc<span style="color: #339933;">,</span> logging<span style="color: #339933;">,</span> level<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066; font-weight: bold;">for</span> each<span style="color: #009900;">&#40;</span>loggerName <span style="color: #000066; font-weight: bold;">in</span> logging.<span style="color: #660066;">LoggerNames</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       mbsc.<span style="color: #660066;">invoke</span><span style="color: #009900;">&#40;</span>logging<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;setLoggerLevel&quot;</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#91;</span>loggerName<span style="color: #339933;">,</span> level<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;java.lang.String&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;java.lang.String&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> ask_level<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   dialog <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Packages.<span style="color: #660066;">org</span>.<span style="color: #660066;">eclipse</span>.<span style="color: #660066;">jface</span>.<span style="color: #660066;">dialogs</span>.<span style="color: #660066;">InputDialog</span><span style="color: #009900;">&#40;</span>
          window.<span style="color: #660066;">getShell</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
          <span style="color: #3366CC;">&quot;Logging Level&quot;</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">&quot;Which level? (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)&quot;</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">&quot;INFO&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
   result <span style="color: #339933;">=</span> dialog.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>result <span style="color: #339933;">==</span> Packages.<span style="color: #660066;">org</span>.<span style="color: #660066;">eclipse</span>.<span style="color: #660066;">jface</span>.<span style="color: #660066;">window</span>.<span style="color: #660066;">Window</span>.<span style="color: #660066;">OK</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #000066; font-weight: bold;">return</span> dialog.<span style="color: #660066;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> show<span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   Packages.<span style="color: #660066;">org</span>.<span style="color: #660066;">eclipse</span>.<span style="color: #660066;">jface</span>.<span style="color: #660066;">dialogs</span>.<span style="color: #660066;">MessageDialog</span>.<span style="color: #660066;">openInformation</span><span style="color: #009900;">&#40;</span>
           window.<span style="color: #660066;">getShell</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
           <span style="color: #3366CC;">&quot;Update Logging&quot;</span><span style="color: #339933;">,</span>
           text
       <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<h3>code walkthrough</h3>

<p>The <code>main()</code> function of the script is:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  mbsc <span style="color: #339933;">=</span> jmx.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;localhost&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3000</span><span style="color: #009900;">&#41;</span>
  logging <span style="color: #339933;">=</span> mbsc.<span style="color: #660066;">getMBean</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;java.util.logging:type=Logging&quot;</span><span style="color: #009900;">&#41;</span>
&nbsp;
   level <span style="color: #339933;">=</span> ask_level<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   set_all<span style="color: #009900;">&#40;</span>mbsc<span style="color: #339933;">,</span> logging<span style="color: #339933;">,</span> level<span style="color: #009900;">&#41;</span>
   text <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;All loggers are set to &quot;</span> <span style="color: #339933;">+</span> level <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
   text <span style="color: #339933;">+=</span> logger_levels<span style="color: #009900;">&#40;</span>mbsc<span style="color: #339933;">,</span> logging<span style="color: #009900;">&#41;</span>
   show<span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<p>where</p>

<ul>
<li><code>mbsc = jmx.connect("localhost", 3000)</code> creates a <code>mbsc</code> object connected to a local JMX server using the <a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#connecting">standard JMX Service URL</a>.</li>
<li><code>logging = mbsc.getMBean("java.util.logging:type=Logging")</code> creates a <code>logging</code> object representing the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/LoggingMXBean.html">LoggingMXBean</a> used to manage the JVM logging.</li>
<li><code>level = ask_level()</code> opens an Eclipse input dialog where you can input the logging level and returns it as a String.</li>
<li><code>set_all(mbsc, logging, level)</code> sets all the loggers at the given level</li>
<li><code>text += logger_levels(mbsc, logging)</code> returns a String representation of all the loggers and their level</li>
<li><code>show(text)</code> opens an Eclipse message dialog</li>
</ul>

<p>The interesting methods are <code>logger_levels()</code> and <code>set_all()</code>. In both methods, we retrieve an attribute of a MBean and invoke an operation.</p>

<p>Let&#8217;s focus on <code>set_all()</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> set_all<span style="color: #009900;">&#40;</span>mbsc<span style="color: #339933;">,</span> logging<span style="color: #339933;">,</span> level<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066; font-weight: bold;">for</span> each<span style="color: #009900;">&#40;</span>loggerName <span style="color: #000066; font-weight: bold;">in</span> logging.<span style="color: #660066;">LoggerNames</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      mbsc.<span style="color: #660066;">invoke</span><span style="color: #009900;">&#40;</span>logging<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;setLoggerLevel&quot;</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#91;</span>loggerName<span style="color: #339933;">,</span> level<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;java.lang.String&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;java.lang.String&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<p><code>logging</code> represents a MBean (it is not a &#8220;real&#8221; MBean, more on that later) and <code>mbsc</code> represents a <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServerConnection.html"><code>MBeanServerConnection</code></a> (but it is not a &#8220;real&#8221; <code>MBeanServerConnection</code>, more on that later).<br />
<code>logging.LoggerNames</code> returns the value of the <code>LoggerNames</code> attribute of the MBean (<em>note that the <em>first letter</em> must be in <em>upper case</em></em>) which is an array of strings.<br />
For each element of this array, we invoke the <code>setLoggerLevel</code> operation using <code>mbsc.invoke()</code>.<br />
This method is very similar to the &#8220;real&#8221; <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServerConnection.html#invoke(javax.management.ObjectName,%20java.lang.String,%20java.lang.Object[],%20java.lang.String[])"><code>MBeanServerConnection.invoke()</code></a> method:</p>

<ol>
<li>something representing a MBean (instead of an ObjectName)</li>
<li>the MBean operation name</li>
<li>the parameters of the operation</li>
<li>the types of the parameters</li>
</ol>

<h3>jmx: an Eclipse Monkey DOM</h3>

<p>What do I mean when I write that <code>logging</code> is not the &#8220;real&#8221; <code>LogginMXBean</code> and that <code>mbsc</code> is not the real <code>MBeanServerConnection</code>?</p>

<p>This 2 types of objects are created by the <code>jmx</code> object in the <code>main()</code> method. This <code>jmx</code> object is in fact an <a href="http://www.eclipse.org/dash/monkey-help.php?key=writing-doms">Eclipse Monkey DOM</a> that is contributed by the plug-in listed in the <code>DOM</code> directive at the top of the script:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">DOM<span style="color: #339933;">:</span> http<span style="color: #339933;">:</span><span style="color: #006600; font-style: italic;">//eclipse-jmx.googlecode.com/svn/trunk/net.jmesnil.jmx.update/net.jmesnil.jmx.monkey.doms</span></pre></div></div>


<p>This plug-in was included in the &#8220;JMX Monkey&#8221; feature which was installed the first time you ran this script.</p>

<p>The <code>jmx</code> DOM has a single method <code>connect(host, port)</code> which connects to a JMX Server using the <a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#connecting">standard JMX Service URL</a>.<br />
The object returned by this method is a <a href="http://eclipse-jmx.googlecode.com/svn/trunk/net.jmesnil.jmx.monkey.doms/src/net/jmesnil/jmx/monkey/doms/ScriptableMBeanServerConnection.java"><code>ScriptableMBeanServerConnection</code></a>. This class encapsulates the &#8220;real&#8221; <code>MBeanServerConnection</code> (still available using the <code>getObject()</code> method) but only exposes its <code>invoke()</code>.</p>

<p>It also exposes a <code>getMBean()</code> method which returns a <a href="http://eclipse-jmx.googlecode.com/svn/trunk/net.jmesnil.jmx.monkey.doms/src/net/jmesnil/jmx/monkey/doms/ScriptableMBean.java"><code>ScriptableMBean</code></a>. In turn this class exposes the attributes of the MBean as JavaScript attributes.</p>

<p>To sum up, these are the operations you can perform using the <code>jmx</code> DOM:</p>

<ul>
<li>connect to a JMX server: <code>mbsc = jmx.connect(host, port)</code></li>
<li>get a mbean: <code>mbean = mbsc.getMBean(objectName)</code></li>
<li>get the value of a mbean attribute: <code>val = mbean.AttributeName</code></li>
<li>get the &#8220;real&#8221; mbean server connection and use it: <code>objectNames = mbsc.getObject().queryNames(name, query)</code></li>
<li>invoke an operation on a mbean: <code>mbsc.invoke(mbean, operation, params, param_types)</code></li>
</ul>

<h3>Conclusion</h3>

<p>This script example is simple but quite interesting thanks to its integration with Eclipse.</p>

<p>I believe there is an use for such scripts: repeatable management operations that needs to be tweaked from time to time.
It&#8217;s tedious to do that with a GUI and it&#8217;s even more tedious to write Java applications to do so.</p>

<p>Last year, during EclipseCon&#8217;06, I blogged about an <a href="http://jmesnil.net/weblog/2006/03/22/use-case-for-scripting-a-rcp-application">use case for scripting a RCP application</a> using Eclipse Monkey.
This is a concrete example: I&#8217;m using <a href="http://code.google.com/p/eclipse-jmx/">eclipse-jmx</a> to manage Java applications that I develop. When I realize that I perform the same kind of management task, I write a monkey script which automates it.</p>

<p>Next time, you have to perform the same operation on many MBeans or many operations on the same MBean but you think it is not worth to write a Java application to automate it, ask yourselves if it can not be simply automated by a script such as the one in this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2007/05/23/jmx-scripts-with-eclipse-monkey/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add a filter to a TreeViewer</title>
		<link>http://jmesnil.net/weblog/2007/02/26/add-a-filter-to-a-treeviewer/</link>
		<comments>http://jmesnil.net/weblog/2007/02/26/add-a-filter-to-a-treeviewer/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 21:57:57 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jmx]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2007/02/21/filter-a-tree-and-search-widget/</guid>
		<description><![CDATA[In eclipse-jmx, a plug-in to manage Java applications through JMX, I have a view which displays registered MBeans using a TreeViewer. Since there can be many MBeans to display (e.g. more than 200 just for Tomcat), it is tedious to navigate in the Tree by expanding many nodes before finding the MBeans I want to [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://code.google.com/p/eclipse-jmx/">eclipse-jmx</a>, a plug-in to manage Java applications through JMX, I have a view which displays registered MBeans using a TreeViewer.<br />
Since there can be many MBeans to display (e.g. more than 200 just for Tomcat), it is tedious to navigate in the Tree by expanding many nodes before finding the MBeans I want to manage.
To make it more usable, I wanted to add a filter text to the view to show only the MBeans which are interesting to me.
<span id="more-144"></span>
UI-wise, I wanted something like the Filtered Extensions of the PDE Editor:</p>

<p><img src="http://download.eclipse.org/eclipse/downloads/drops/S-3.3M1-200608101230/images/filtered_extensions.png" alt="Filtered Extensions in the PDE Editor" /></p>

<p>It shows only the extensions matching the filter text (and also displays the extensions categories).</p>

<p>Since this screenshot was from <a href="http://download.eclipse.org/eclipse/downloads/drops/S-3.3M1-200608101230/eclipse-news-M1.html">Eclipse 3.3M1 New &amp; Noteworthy</a>, I thought that this filter was not available for Eclipse 3.2 (or that it was specific to PDE).<br />
It turns out that I was wrong, it works on Eclipse 3.2, and it takes only 2 lines to add such behavior to any TreeViewer  using a <a href="http://help.eclipse.org/help32/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/dialogs/PatternFilter.html">PatternFilter</a> and a <a href="http://help.eclipse.org/help32/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/dialogs/FilteredTree.html">FilteredTree</a> (which are from the <code>org.eclipse.ui.workbench</code> plug-in).</p>

<h2>Plain Old TreeViewer</h2>

<p>The code to create the TreeViewer is straightforward:</p>

<pre><code>public void createPartControl(Composite parent) {
    ...
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    ...
}
</code></pre>

<p>which, in eclipse-jmx, gives:</p>

<p><img src="http://jmesnil.net/img/e-jmx/mbean-explorer-hierarchical_0.1.0.png" alt="MBean Explorer from eclipse-jmx 0.1.1" /></p>

<h2>PatternFilter &amp; FilteredTree</h2>

<p>To filter the tree&#8217;s nodes, the code to change is minimal:</p>

<pre><code>public void createPartControl(Composite parent) {
    ...
    PatternFilter patternFilter = new PatternFilter();
    final FilteredTree filter = new FilteredTree(parent, SWT.MULTI
            | SWT.H_SCROLL | SWT.V_SCROLL, patternFilter);
    viewer = filter.getViewer();
    ...
}
</code></pre>

<p>With these 2 lines, a filter widget is displayed on top of the tree and the tree&#8217;s nodes are automatically filtered based on the filter text:</p>

<p><img src="http://jmesnil.net/img/e-jmx/mbean-explorer-filter_0.1.2.png" alt="MBean Explorer from eclipse-jmx 0.1.2 with filter" /></p>

<p>Screenshot has been taken on Eclipse 3.3M5 which uses native search widgets (if one is available) to display the filter control.
It works also on Eclipse 3.2 but does not look so good.</p>

<p>By default, PatternFilter will display any nodes of the Tree whose label matches the filter text. By extending it, it is very simple to have more complex filter matching algorithm.<br />
It is the case in <a href="http://code.google.com/p/eclipse-jmx/">eclipse-jmx</a>: it displays any node whose descendant&#8217;s leaves have an ObjectName which matches the filter text.</p>

<p>Kudos to the workbench team for this little UI nugget!</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2007/02/26/add-a-filter-to-a-treeviewer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Equinox Resources Monitoring</title>
		<link>http://jmesnil.net/weblog/2006/08/22/equinox-resource-monitoring/</link>
		<comments>http://jmesnil.net/weblog/2006/08/22/equinox-resource-monitoring/#comments</comments>
		<pubDate>Tue, 22 Aug 2006 13:45:51 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jmx]]></category>
		<category><![CDATA[osgi]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/08/22/equinox-resource-monitoring/</guid>
		<description><![CDATA[Too much work is done around Eclipse (RCP, Equinox, BIRT, Monkey) that I can&#8217;t follow all the things which interests me. However, by browsing the mailing list of the Equinox (Eclipse&#8217;s OSGi implementation), I discovered a cool new project in the Equinox incubator: Resources Monitoring. Its mission statement? To provide a framework for monitoring resources [...]]]></description>
			<content:encoded><![CDATA[<p>Too much work is done around <a href="http://eclipse.org">Eclipse</a> (RCP, Equinox, BIRT, Monkey) that I can&#8217;t follow all the things which interests me.</p>

<p>However, by browsing the mailing list of the <a href="http://www.eclipse.org/equinox/">Equinox</a> (Eclipse&#8217;s <a href="http://www.osgi.org/">OSGi</a> implementation), I discovered a cool new project in the Equinox incubator: <a href="http://www.eclipse.org/equinox/incubator/monitoring/index.php">Resources Monitoring</a>.</p>

<p>Its mission statement?</p>

<blockquote>
  <p>To provide a framework for monitoring resources that are contributed by bundles installed on the host machine. The term &#8216;resources&#8217; is used to
  describe something as specific as a single object or something as abstract as an OSGI bundle.</p>
</blockquote>

<p>It seems to use <a href="http://java.sun.com/products/JavaManagement/">JMX</a> to manage the resources and to provide both the server and the client code to manage the resources.</p>

<p>Definitively worth a look&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/08/22/equinox-resource-monitoring/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An Outliner application based on Eclipse RCP</title>
		<link>http://jmesnil.net/weblog/2006/07/31/an-outliner-application-based-on-eclipse-rcp/</link>
		<comments>http://jmesnil.net/weblog/2006/07/31/an-outliner-application-based-on-eclipse-rcp/#comments</comments>
		<pubDate>Mon, 31 Jul 2006 18:06:05 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/07/31/an-outliner-application-based-on-eclipse-rcp/</guid>
		<description><![CDATA[While cleaning up my workpace, I (re) discovered a small application I wrote to familiarize myself with Eclipse editors development. It is a simple outliner which reads and writes OPML files. Each OPML file is opened in an Eclipse Editor. You can navigate the outliner, indent/outdent the outlines, create new outlines and edit them. To [...]]]></description>
			<content:encoded><![CDATA[<p>While cleaning up my workpace, I (re) discovered a small application I wrote to familiarize myself with Eclipse editors development.</p>

<p>It is a simple outliner which reads and writes OPML files. Each OPML file is opened in an Eclipse Editor. You can navigate the outliner, indent/outdent the outlines, create new outlines and edit them.<br />
To toggle between the edition and the navigation modes, you can use the ESC key (like in vi).</p>

<p><img src="http://jmesnil.googlepages.com/eclipse-outliner.jpg/eclipse-outliner-large.jpg" alt="Eclipse Outliner Screenshot" /></p>

<p>The code is pre-pre alpha (hence the 0.1.1 version) and a lot of essential features are missing:</p>

<ul>
<li>no copy/paste</li>
<li>The OPML parser is home-made and parses only a subset of <a href="http://www.opml.org/spec2">OPML 2.0</a> (but at least, I can read some OPML 2.0 examples such as <a href="http://hosting.opml.org/dave/spec/states.opml">states.opml</a>)</li>
<li>I pretty sure that the generated OPML is not valid</li>
</ul>

<p>The fun part of the application is the <a href="http://eclipse-outliner.googlecode.com/svn/trunk/net.jmesnil.outliner.ui/src/net/jmesnil/outliner/ui/editors/OutlinerEditor.java">OutlinerEditor</a>. Each OutlinerEditor is composed of a TreeViewer which displays the outline.
The TreeViewer is not editable but each cell of the tree can be edited in place (a la <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.java">SWT snippet #111</a>).</p>

<p>I released this project on <a href="http://code.google.com/hosting/">Google Code&#8217;s project hosting</a> under the Apache License 2.0 and created a corresponding <a href="http://jmesnil.googlepages.com/eclipseoutliner">web site</a> to complement the <a href="http://code.google.com/p/eclipse-outliner/">project home</a>.
You can check it out using Subversion but to make it simpler to check out, you can import in your workspace the <a href="http://jmesnil.googlepages.com/eclipseoutliner.psf">Outliner Team Project Set</a> (provided you have a Subversion plug-in like <a href="http://subclipse.tigris.org/">Subclipse</a>).
I don&#8217;t plan to work extensively on this application but I thought it could be of some interest for new Eclipse RCP developers.</p>

<p>I developped the application on Mac OS X and had the bad surprise to see that the application is not working properly on Linux  because I can&#8217;t navigate the tree with the arrow keys (see issue <a href="http://code.google.com/p/eclipse-outliner/issues/detail?id=3&amp;can=2&amp;q=">#3</a>).
It seems to be a &#8220;bug&#8221; in SWT since I can&#8217;t navigate with the arrow keys in SWT snippet #111 either.  Though I&#8217;m not sure this is a SWT bug or a platform specific behavior&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/07/31/an-outliner-application-based-on-eclipse-rcp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse&#8217;s ISetSelectionTarget interface</title>
		<link>http://jmesnil.net/weblog/2006/07/03/isetselectiontarget/</link>
		<comments>http://jmesnil.net/weblog/2006/07/03/isetselectiontarget/#comments</comments>
		<pubDate>Mon, 03 Jul 2006 14:29:00 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/06/23/isetselectiontarget/</guid>
		<description><![CDATA[I just found a new Interface in Eclipse which I found quite handy. Let&#8217;s say that you have an action which creates a new resource and you want to notify views that they have to show this resource. The key interface is ISetSelectionTarget. If your views respond to this interface (by implementation or adaptation), they [...]]]></description>
			<content:encoded><![CDATA[<p>I just found a new Interface in Eclipse which I found quite handy.</p>

<p>Let&#8217;s say that you have an action which creates a new resource and you want to notify
views that they have to show this resource.</p>

<p>The key interface is <a href="http://help.eclipse.org/help31/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/part/ISetSelectionTarget.html">ISetSelectionTarget</a>.
If your views respond to this interface (by implementation or adaptation), they can then receive a <code>selectReveal(ISelection selection)</code> message.</p>

<p>For example, one of my view implements ISetSelectionTarget and defines the method:</p>

<pre><code>    public void selectReveal(ISelection selection) {
       StructuredSelection ssel = convertSelection(selection);
       if (!ssel.isEmpty()) {
          viewer.getControl().setRedraw(false);
          viewer.setSelection(ssel, true);
          viewer.getControl().setRedraw(true);
       }
    }
</code></pre>

<p>How do you send this <code>selectReveal()</code> message from your action?<br />
An example is found in the JDT, in the <code>org.eclipse.ui.wizards.newresource.BasicNewResourceWizard</code> class:</p>

<pre><code>  public static void selectAndReveal(IResource resource, IWorkbenchWindow window) {
    // validate the input
    if (window == null || resource == null)
        return;
    IWorkbenchPage page = window.getActivePage();
    if (page == null)
        return;

    // get all the view and editor parts
    List parts = new ArrayList();
    IWorkbenchPartReference refs[] = page.getViewReferences();
    for (int i = 0; i &lt; refs.length; i++) {
        IWorkbenchPart part = refs[i].getPart(false);
        if (part != null)
            parts.add(part);
    }
    refs = page.getEditorReferences();
    for (int i = 0; i &lt; refs.length; i++) {
        if (refs[i].getPart(false) != null)
            parts.add(refs[i].getPart(false));
    }

    final ISelection selection = new StructuredSelection(resource);
    Iterator itr = parts.iterator();
    while (itr.hasNext()) {
        IWorkbenchPart part = (IWorkbenchPart) itr.next();

        // get the part's ISetSelectionTarget implementation
        ISetSelectionTarget target = null;
        if (part instanceof ISetSelectionTarget)
            target = (ISetSelectionTarget) part;
        else
            target = (ISetSelectionTarget) part.getAdapter(ISetSelectionTarget.class);

        if (target != null) {
            // select and reveal resource
            final ISetSelectionTarget finalTarget = target;
            window.getShell().getDisplay().asyncExec(new Runnable() {
                public void run() {
                    finalTarget.selectReveal(selection);
                }
            });
        }
    }
  }
</code></pre>

<p>However, your code does not need to be that generic. If you already know which view may
be interested to be notified, you can use</p>

<pre><code>IViewPart part = page.findView(viewId):
</code></pre>

<p>to retrieve the interested <code>IViewPart</code> and after checking that it will respond to <code>ISetSelectionTarget</code>
(either by implementation or adaptation), you can send it a  <code>selectReveal()</code> message directly.</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/07/03/isetselectiontarget/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Eclipse 3.2 and Welcome page on Ubuntu</title>
		<link>http://jmesnil.net/weblog/2006/07/03/eclipse-32-and-welcome-page-on-ubuntu/</link>
		<comments>http://jmesnil.net/weblog/2006/07/03/eclipse-32-and-welcome-page-on-ubuntu/#comments</comments>
		<pubDate>Mon, 03 Jul 2006 14:02:20 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/07/03/eclipse-32-and-welcome-page-on-ubuntu/</guid>
		<description><![CDATA[Eclipse 3.2 is out and it is a great release. However, the default Welcome page I had on my Ubuntu desktop is quite broken it is ugly the links to the workbench are broken (links like http://org.eclipse.ui.intro/showPage?id=overview open in Firefox) when I close it, it asks me to save a file After a little search [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse 3.2 is out and it is a great release. <img src='http://jmesnil.net/weblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>However, the default Welcome page I had on my <a href="http://www.ubuntu.com/">Ubuntu</a> desktop is
quite broken</p>

<p><img src="/img/broken-welcome-3.2.jpg" alt="Broken Welcome Page in Eclipse 3.2" /></p>

<ul>
<li>it is ugly</li>
<li>the links to the workbench are broken (links like http://org.eclipse.ui.intro/showPage?id=overview open in Firefox)</li>
<li>when I close it, it asks me to save a file</li>
</ul>

<p>After a little search on eclipe.org <a href="http://www.eclipse.org/swt/faq.php#browserlinux">SWT FAQ</a>,
it appears that by default, Ubuntu is missing the <code>MOZILLA_FIVE_HOME</code> which is required by
SWT to use the web browser internally.</p>

<p>I just added this variable before starting Eclipse:</p>

<pre><code>export MOZILLA_FIVE_HOME=/usr/lib/mozilla-firefox/
</code></pre>

<p>and the Welcome page appeared as expected:</p>

<p><img src="/img/welcome-3.2.jpg" alt="Welcome Page in Eclipse 3.2" /></p>

<p>I really like the new theme (Circles) by the way.
)</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/07/03/eclipse-32-and-welcome-page-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to stop SWT Control traversal action</title>
		<link>http://jmesnil.net/weblog/2006/04/18/stop-event-propagation-in-eclipse/</link>
		<comments>http://jmesnil.net/weblog/2006/04/18/stop-event-propagation-in-eclipse/#comments</comments>
		<pubDate>Tue, 18 Apr 2006 20:25:35 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/04/18/stop-event-propagation-in-eclipse/</guid>
		<description><![CDATA[Another ah-ha moment with Eclipse&#8230; It is quite simple but I stumble upon it before finding how in Eclipse you can stop the traversal of SWT Control from a TraverseListener implementation. In your listener, handle the TraverseEvent event and then just event.doit = false; and the system will stop traversing the Controls. Everything is well [...]]]></description>
			<content:encoded><![CDATA[<p>Another ah-ha moment with <a href="http://eclipse.org/">Eclipse</a>&#8230;</p>

<p>It is quite simple but I stumble upon it before finding how in Eclipse you can stop the traversal of SWT <code>Control</code> from a <code>TraverseListener</code> implementation.</p>

<p>In your listener, handle the <code>TraverseEvent</code> event and then just</p>

<pre><code>event.doit = false;
</code></pre>

<p>and the system will stop traversing the Controls.</p>

<p>Everything is well explained in <a href="http://help.eclipse.org/help31/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/events/TraverseEvent.html">TraverseEvent javadoc</a> (but I&#8217;m guilty of not reading javadoc until I need it&#8230;). The explanation is worth a read and shows how powerful traversal can be in eclipse using both <code>TraverseEvent</code> <code>detail</code> and <code>doit</code> fields.</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/04/18/stop-event-propagation-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Highlights of Greg Stein&#8217;s keynote</title>
		<link>http://jmesnil.net/weblog/2006/03/22/highlights-of-greg-steins-keynote/</link>
		<comments>http://jmesnil.net/weblog/2006/03/22/highlights-of-greg-steins-keynote/#comments</comments>
		<pubDate>Wed, 22 Mar 2006 18:00:59 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/03/22/highlights-of-greg-steins-keynote/</guid>
		<description><![CDATA[Some highlights from Greg Stein&#8217;s keynote The Apache Way Communities first, code second Communities over individuals Apache central to Open Source work but Eclipse is also gravitating to the center The license trend is going to the bottom Proprietary &#124; v Restricted &#124; v Copyleft (GPL, EPL) &#124; v Non-copyleft (APL, BSD) I found it [...]]]></description>
			<content:encoded><![CDATA[<p>Some highlights from <a href="http://www.eclipsecon.org/2006/Sub.do?id=106">Greg Stein&#8217;s keynote</a></p>

<h3>The Apache Way</h3>

<blockquote>
  <ul>
  <li>Communities first, code second  </li>
  <li>Communities over individuals</li>
  <li>Apache central to Open Source work but Eclipse is also gravitating to the center  </li>
  <li>The license trend is going to the bottom</li>
  </ul>
</blockquote>

<p><center></p>

<pre><code> Proprietary
  |
  v
 Restricted
  |
  v
 Copyleft (GPL, EPL)
  |
  v
 Non-copyleft (APL, BSD)   
</code></pre>

<p></center></p>

<p>I found it quite interesting to see how  <a href="http://apache.org">Apache</a> is organized and how  <a href="http://eclipse.org">Eclipse</a> compares to it.</p>

<p>For now, there is few overlaps between Apache and Eclipse communities but it has already started.<br />
For example, both communities now offer an <a href="http://osgi.org">OSGi</a> implementation:</p>

<ul>
<li><a href="http://www.eclipse.org/equinox/">Equinox</a> for Eclipse</li>
<li><a href="http://incubator.apache.org/felix/">Felix</a> for Apache (in the incubator)</li>
</ul>

<p>It it going to be interesting to see where things are going&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/03/22/highlights-of-greg-steins-keynote/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use case for scripting a RCP application</title>
		<link>http://jmesnil.net/weblog/2006/03/22/use-case-for-scripting-a-rcp-application/</link>
		<comments>http://jmesnil.net/weblog/2006/03/22/use-case-for-scripting-a-rcp-application/#comments</comments>
		<pubDate>Wed, 22 Mar 2006 04:51:14 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/03/21/use-case-for-scripting-a-rcp-application/</guid>
		<description><![CDATA[I attended the Scripting Eclipse panel which was quite interesting (see Ed&#8217;s transcript. Scripting Eclipse means a lot of different things to different people. My own interest is to provide scripting ability to a RCP application so that its users can customize it for their needs and create their own workflow. For example, imagine that [...]]]></description>
			<content:encoded><![CDATA[<p>I attended the <a href="http://www.eclipsecon.org/2006/Sub.do?id=334">Scripting Eclipse panel</a> which was quite interesting (see <a href="http://blogs.zdnet.com/Burnette/?p=42">Ed&#8217;s transcript</a>.</p>

<p>Scripting Eclipse means a lot of different things to different people.<br />
My own interest is to provide scripting ability to a RCP application so that its users can customize it for their needs and create their own workflow.</p>

<p>For example, imagine that the RCP application is used to manage remote resources. Each resources can be manage individually through a set of methods.<br />
But what if you want to provide a workflow for advanced operations?</p>

<p>One way to do this is through wizards. But with that solution, users lose control like Joel Spolksy explained in <a href="http://www.eclipsecon.org/2006/Sub.do?id=24">his presentation</a>.<br />
Besides it is very difficult to provide wizards which makes simple things simple and complex things possible. They tend to become uncluttered and undecipherable.</p>

<p>Another way is to provide cheatsheets. However, interaction between the cheatsheets and the user interface remains basic. And users are still not in control: they must follow the steps dictated by the cheatsheets.</p>

<p>Now, imagine that we expose a <abbrev title="Domain Object Model">DOM</abbrev> of the managed resources and we let users script their processes.
They are in control and <em>they</em> manage the workflow of <em>their</em> resources.
They win because they are in control and we (the RCP developpers) win because we can keep our RCP application simple. We just have to expose the simplest useful DOMs to our users to let them handle themselves their more complex and specific processes.</p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/03/22/use-case-for-scripting-a-rcp-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Console DOM for Eclipse Monkey script</title>
		<link>http://jmesnil.net/weblog/2006/03/21/console-dom-for-eclipse-monkey-script/</link>
		<comments>http://jmesnil.net/weblog/2006/03/21/console-dom-for-eclipse-monkey-script/#comments</comments>
		<pubDate>Tue, 21 Mar 2006 22:59:06 +0000</pubDate>
		<dc:creator>Jeff Mesnil</dc:creator>
				<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://jmesnil.net/weblog/2006/03/21/console-dom-for-eclipse-monkey-script/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a simple DOM to write message to Eclipse console from a <a href="http://eclipse.org/dash/">Monkey</a> Script.</p>

<p><strike>I have not yet created an update site for it so you have do <a href="/downloads/net.jmesnil.doms_0.0.1.jar">download it</a> and install it in your plugins directory manually.</strike><br />
It provides a <code>out</code> variable that you can use to write to a console.</p>

<p>Here is the mandatory &#8220;Hello, World&#8221; example:</p>

<pre><code>--- Came wiffling through the eclipsey wood ---
/*
 * Menu: Console &gt; 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! ---
</code></pre>

<p>and its output</p>

<p><img src="/img/console.png" alt="Hello, World console screenshot" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jmesnil.net/weblog/2006/03/21/console-dom-for-eclipse-monkey-script/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
