tag:blogger.com,1999:blog-69170716447157433082024-03-13T13:35:36.618-07:00Contraptions for programmingThis is a blog about some of the nifty things I have been working on. Mostly, I talk about Eclipse, Groovy, and AspectJ.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.comBlogger54125tag:blogger.com,1999:blog-6917071644715743308.post-18029657607398088352014-03-12T21:17:00.003-07:002014-03-12T21:17:49.290-07:00Unshackling Mylyn from the DesktopNext week at <a href="https://www.eclipsecon.org/na2014/" target="_blank">EclipseCon</a>, I'll be giving a talk with <a href="https://twitter.com/guw" target="_blank">Gunnar Wagenknecht</a> on our side project <a href="https://www.eclipsecon.org/na2014/session/unshackling-mylyn-desktop" target="_blank">to bring a hosted task list to Mylyn</a>. This is something that I'm really excited about and it will be the first time we are discussing this project in public. The <a href="http://eclipse.org/mylyn" target="_blank">Mylyn</a> project was a truly ground-breaking project when it first became an Eclipse project back in 2005. It revolutionized the way that developers work with and manage the over-abundance of information in the IDE. Now, even though it is still a well-used and loved project, it has not been evolving at the same rate that developers' expectations have. Since being introduced, developers tend to be less tied to their IDE, using git on the command line, github in the browser, and email on a tablet. However, the Mylyn task list is stuck in the IDE.<br />
<br />
In our presentation, we’ll be demoing a hosted task list, that can gather tasks from multiple task repositories (Jira, Bugzilla, etc), store them on a server, and then provides an open API to interact with them. The API is open, using a mix of REST and websockets, and this is the interesting part since the API allows you to build clients that interact with your task list in ways that were never possible before.<br />
<br />
If you’re interested, I hope you’re coming to EclipseCon so you can see our talk. If not, you’ll have to wait until later when I have some time to write a proper blog post about this.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com1tag:blogger.com,1999:blog-6917071644715743308.post-42830078979181202652013-06-06T21:41:00.000-07:002013-06-06T21:41:42.507-07:00Where's the memory leak?A few days ago, I was tracking down a memory leak through Yourkit and I was pointed to this code (vastly oversimplified, but just complex enough to prove my point):<br />
<br />
<script src="https://gist.github.com/aeisenberg/5727103.js"></script><br />
<br />
This code is part of a compiler and stores some metadata on an Abstract Syntax Tree node during byte-code creation. The profiler told me that there were thousands of <tt>ClosureWriter</tt> instances being kept around for the length of the compile (roughly one for each closure defined in the program). While not a huge amount of memory, this bothered me. For a while, I couldn't figure out why these references stuck around. Then it occurred to me that each reference to <tt>ClosureWriter.UseExistingReference.class</tt> keeps a back pointer to the enclosing <tt>ClosureWriter</tt> instance. By changing the <tt>UseExistingReference</tt> to static, the leak disappeared.<br />
<br />
<h4>What's the lesson?</h4><br />
In Java, always, always declare your inner classes as static unless you are sure that you need back references to the enclosing instance.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com6tag:blogger.com,1999:blog-6917071644715743308.post-32895631440328732122012-11-23T09:32:00.003-08:002012-11-23T09:32:38.447-08:00What is this cloud thing?Here are the slides from my UBC alumni presentation on programming for the cloud.<br />
<br />
<iframe src="http://www.slideshare.net/slideshow/embed_code/15317559" width="476" height="400" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br />
<br />
You can also download the demo code that I wrote during the talk <a href="https://github.com/aeisenberg/rabbit-producer-consumer">here on github</a>.<br />
<br />
Thank you all who came. It was a lot of fun to give the talk.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com1tag:blogger.com,1999:blog-6917071644715743308.post-68452055019359257502012-11-17T13:59:00.002-08:002012-11-17T14:01:26.052-08:00Lots of beer, pizza, and codingLots of beer, pizza, and coding. I'd say that our second Vancouver Eclipse hackathon was a huge success. We had committers from several Eclipse and Eclipse based projects: <a href="http://eclipse.org/mylyn">Mylyn</a>, <a href="http://wiki.eclipse.org/Equinox/p2">p2</a>, <a href="http://eclipse.org/jdt">JDT</a>, <a href="http://orion.eclipse.org">Orion</a>, and <a href="https://github.com/scripted-editor/scripted/">Scripted</a> were all represented. We had 30 hackers spread across all of these projects. Currently, we have 7 patches that have been accepted into codebases, and three more that are working their way through the submission process.<br />
<br />
The hackathon was a great and social way to be introduced into the open-source world and perhaps some of these new Eclipse contributors can become Eclipse committers. If you are interested in holding an Eclipse hackathon (or any hackathon) in your area, feel free to contact me. I now know what works and what doesn't.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6XW33zFGpMZO4_KyKc-Xl0UlBGZigOZfs3yRhxLvkrqQxEXwBtl0qbe-1XVSJfC66lr9UTlzyLW4F0xA9zvhYsRIBVcGv2gJz5Y7EsRJOUKZkObq0-9i5IuMEesJ4BjFx25rv1kZ7ebs/s1600/Last+Import+-+14.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="239" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6XW33zFGpMZO4_KyKc-Xl0UlBGZigOZfs3yRhxLvkrqQxEXwBtl0qbe-1XVSJfC66lr9UTlzyLW4F0xA9zvhYsRIBVcGv2gJz5Y7EsRJOUKZkObq0-9i5IuMEesJ4BjFx25rv1kZ7ebs/s320/Last+Import+-+14.jpg" /></a><br />
Just getting started</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4aqbV3Jg-7RtZVf70PRbfLaExxGWiHIIyBAC_umd2nRoxjMeViBsWbFMlDRbUcaENwSZKfCDEa7Nj868i26URR3hyphenhyphen7Xb7vq9_usxB6r9q6fEcG09Vy-k6YSiMUDHa4is-oNR88lyC684/s1600/all+working.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="201" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4aqbV3Jg-7RtZVf70PRbfLaExxGWiHIIyBAC_umd2nRoxjMeViBsWbFMlDRbUcaENwSZKfCDEa7Nj868i26URR3hyphenhyphen7Xb7vq9_usxB6r9q6fEcG09Vy-k6YSiMUDHa4is-oNR88lyC684/s320/all+working.png" /></a><br />
All working hard<br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWMv4pwDuYMgKyHoGQFZxBTupP5hHXKDywQ2P_-9wVr1ich-SFYPmFnuJ2ZOv2EUfwi-EfFv_7tFo-fEfQzgV9BwyoONBr7N7rvvjQqjoCxcqEy7TDCyzstTceECZSyBbpLbny2QQw88k/s1600/Last+Import+-+09.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="239" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWMv4pwDuYMgKyHoGQFZxBTupP5hHXKDywQ2P_-9wVr1ich-SFYPmFnuJ2ZOv2EUfwi-EfFv_7tFo-fEfQzgV9BwyoONBr7N7rvvjQqjoCxcqEy7TDCyzstTceECZSyBbpLbny2QQw88k/s320/Last+Import+-+09.jpg" /></a><br />
Nieraj and Leo take a moment to relax<br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://tasktop.com/sites/default/files/images/events/hackathon2012/IMG_0277.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="300" src="http://tasktop.com/sites/default/files/images/events/hackathon2012/IMG_0277.JPG" /></a><br />
Ian Skerret, flew all the way from Ottawa for us</div><br />
A big thank you to all the project leads who helped (and are still helping) some newcomers fixing their first bug. And an even bigger thank you to everyone who worked hard and stayed up late, just to do some coding. It was a lot of fun.<br />
<br />
For another look at the hackathon and more photos, see the <a href="http://tasktop.com/blog/eclipse/deep-inside-an-eclipse-hackathon-where-the-future-eclipse-submitters-are-born">Tasktop blog</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com1tag:blogger.com,1999:blog-6917071644715743308.post-17208222633282813002012-11-01T21:36:00.000-07:002012-11-01T21:36:17.894-07:00JSDoc is more than just documentation (in Scripted)Recently, we released the <a href="https://github.com/scripted-editor/scripted/">Scripted editor</a> for editing your JavaScript. It's still early stages, but our focus on a light-weight and semantically aware editor already has some compelling features. In this blog post, I'll show you how you can use JSDoc in your JavaScript files to provide Scripted with some inferencing help. Since Scripted uses the <a href="http://orion.eclipse.org">Orion</a> editor, most of this JSDoc support is also available in Orion.<br />
<br />
There are many flavors of JSDoc and there is no standard, but the <a href="https://developers.google.com/closure/compiler/docs/js-for-compiler">Google Closure Compiler</a> uses a style that is well-documented, self-consistent, and complete. We use <a href="http://constellation.github.com/doctrine/demo/index.html">Doctrine</a> as the JSDoc parser, which has a complete understanding of the JSDoc annotations of the Closure Compiler.<br />
<br />
Currently, Scripted recognizes a subset of JSDoc tags:<br />
<br />
<ul><li><tt>@type {type-sig} {optional-doc}</tt> specifies the type of a variable declaration</li>
<li><tt>@param {type-sig} {param-name} {optional-doc}</tt> specifies the type of a function parameter. Parameter annotations are not positional. They must correspond to an actual named argument of the function.</li>
<li><tt>@return {type-sig} {optional-doc}</tt> specifies the return type of a function</li>
</ul><br />
The docs for the Closure Compiler specify many kinds of type signatures. Only a subset are relevant to and supported in Scripted. Scripted recognizes:<br />
<br />
<ul> <li>Simple types, eg- <tt>{Window}</tt>, <tt>{boolean}</tt>, <tt>{Boolean}</tt></li>
<li>Record types, eg- <tt>{{myNum: number, myObject}}</tt></li>
<li>Function types, eg- <tt>{function(arg0:string,arg1:boolean)}</tt></li>
<li>Function return types, eg- <tt>{function():number}</tt></li>
</ul><br />
And of course, type signatures can be combined to produce more complex signatures. The built-in types boolean, number, string, and object can optionally be capitalized, this breaks from the semantics of the closure compiler, but provides more flexibility to programmers. Other kinds of signatures are tolerated, but do not affect the inferred type. <br />
<br />
<h3>Examples</h3><br />
With this information, we can start showing some examples. Scripted uses typing information for hovers, navigation (e.g., CTRL+Click to navigate to definitions), and for content assist.<br />
<br />
<h4>Simple @type</h4><br />
Here is a simple JSDoc comment to define a string variable:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr_T_bsFOBCSqki3r4zHueUXw6Ek4WyLMiTNYjJefg_WHUerjUxKU1GdieTuTzD7R9RE8TQ8iTjut9rPulZYoKybMbejJ3z6bry2p0TE4BJhyphenhyphendHRgWb3uC-or-3Yem3ZoEqsqmeXSVnSM/s1600/simpleStringType.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="86" width="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr_T_bsFOBCSqki3r4zHueUXw6Ek4WyLMiTNYjJefg_WHUerjUxKU1GdieTuTzD7R9RE8TQ8iTjut9rPulZYoKybMbejJ3z6bry2p0TE4BJhyphenhyphendHRgWb3uC-or-3Yem3ZoEqsqmeXSVnSM/s320/simpleStringType.png" /></a></div><h4>Record types</h4><br />
Using a record type signature, you can define the type of an object literal:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwnwVd3o4HU4h6kn69LSaXs6Mflha-W3cJH78MFs_jqOaFEXrBJY7AfW0PQN83PObhyphenhyphenfp9igCLkCkSh7X1g36sAqlvQAFkoOvV3j7bdPAyaRguWf9pv244lwVa2X1v6n5xMsuW41_1-wM/s1600/recordType.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="54" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwnwVd3o4HU4h6kn69LSaXs6Mflha-W3cJH78MFs_jqOaFEXrBJY7AfW0PQN83PObhyphenhyphenfp9igCLkCkSh7X1g36sAqlvQAFkoOvV3j7bdPAyaRguWf9pv244lwVa2X1v6n5xMsuW41_1-wM/s320/recordType.png" /></a></div><h4>Functions</h4><br />
You can specify that a variable is a function, as well as include its parameter names and return types (parameter types are currently ignored for function type signatures). It looks like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSC-xFmR-1T5BVGSRMITh94WGGHmKlWnWNDnU9w7gKPdlNAnUe7IIm5g1v3-vMUABpol27hyphenhyphenpVJjP1qJfn-wup1HqruXfhJO-DNUPqoOz_WuGy2nP7iXfN3dMwEaExYsg6mU7UhqBk838/s1600/functionType.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="75" width="307" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSC-xFmR-1T5BVGSRMITh94WGGHmKlWnWNDnU9w7gKPdlNAnUe7IIm5g1v3-vMUABpol27hyphenhyphenpVJjP1qJfn-wup1HqruXfhJO-DNUPqoOz_WuGy2nP7iXfN3dMwEaExYsg6mU7UhqBk838/s320/functionType.png" /></a></div><br />
If you want to declare the types of function parameters, then you should be using the @param annotation, like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlALUCvglEQPDRCLD1EUF9HNEpRmhG12XSDRAygR7mRJbsUgbvarr4YRqKzXr98fs09AL2dNTAcev4GlnMJdPcyfEr_w2Y-sq_fi0Cf3z4bDLKiuYAxK3bl0FUYcboysuJNo4If3kqOj0/s1600/functionParam.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="132" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlALUCvglEQPDRCLD1EUF9HNEpRmhG12XSDRAygR7mRJbsUgbvarr4YRqKzXr98fs09AL2dNTAcev4GlnMJdPcyfEr_w2Y-sq_fi0Cf3z4bDLKiuYAxK3bl0FUYcboysuJNo4If3kqOj0/s320/functionParam.png" /></a></div><h4>User defined types</h4><br />
User defined types are recognized as well:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmibv8yRxoa17ejfCiJBpFseZY0a3vC3W5tR1cAMIoVKbyN4Hmpjgke4xT7CJfBXuIcvYwTlUSNqoHdzCLZbxcSZR9eta4NRWelHOaoK90FeBlt5BIiESuKqRJIrT0TS3Gy76LFMMtack/s1600/customType1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="169" width="316" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmibv8yRxoa17ejfCiJBpFseZY0a3vC3W5tR1cAMIoVKbyN4Hmpjgke4xT7CJfBXuIcvYwTlUSNqoHdzCLZbxcSZR9eta4NRWelHOaoK90FeBlt5BIiESuKqRJIrT0TS3Gy76LFMMtack/s320/customType1.png" /></a></div><h4>Union types</h4><br />
One possible point of confusion is with union types. They are interpreted by Scripted as whatever the first signature is. So, in the following is interpreted as a string:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR0EkZNwe1-LKeg2D9YvA6BNppDcB7sah01399SP1D0oVUIperbHx-Qak2g4rvKfhYsbVsxzFHr3GPASsBeJCBND8B70mMDulBvNVklZUl9OQCGPxE_oeroA1CXSJ8q7HmrPRdmMK34Gg/s1600/uniontype.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="79" width="279" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR0EkZNwe1-LKeg2D9YvA6BNppDcB7sah01399SP1D0oVUIperbHx-Qak2g4rvKfhYsbVsxzFHr3GPASsBeJCBND8B70mMDulBvNVklZUl9OQCGPxE_oeroA1CXSJ8q7HmrPRdmMK34Gg/s320/uniontype.png" /></a></div><h4>Node support</h4><br />
And finally, Scripted's JSDoc support can be combined with its dependency analysis to infer types defined in other modules. This is extremely helpful for node projects where the use of callbacks can obscure the parameter types. In the following example, by specifying the types of the req an res parameters, you can get some meaningful content assist for them:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig6rZoOrX8cN2ONsW_vS1GXTmWr6hbAagkCF0eb1yblevBosB98hLq9qmrVbpemaefdlkfU2wjgIf7TxzVb8dk2eKE4e6yGKu_7XLeOR7_t8o5wbhFMvWVh6sXiyiINptV2hR5VWb6k60/s1600/node1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="223" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig6rZoOrX8cN2ONsW_vS1GXTmWr6hbAagkCF0eb1yblevBosB98hLq9qmrVbpemaefdlkfU2wjgIf7TxzVb8dk2eKE4e6yGKu_7XLeOR7_t8o5wbhFMvWVh6sXiyiINptV2hR5VWb6k60/s320/node1.png" /></a></div><h3>What's next</h3><br />
There are some more interesting cases that we should handle. A common idiom in JavaScript is to declare constructors using qualified names. Libraries like Dojo and Ext JS. For example, you can define a class name in <a href="http://www.objis.com/formationextjs/lib/extjs-4.0.0/docs/guide/class_system.html">Ext JS like this</a>:<br />
<pre>Ext.define('scripted.Widget', { ... });
</pre><br />
And in <a href="http://dojotoolkit.org/reference-guide/1.8/dojo/_base/declare.html#dojo-base-declare">Dojo</a>:<br />
<br />
<pre>var Widget = dojo.declare('scripted.Widget', [], { ... });
</pre><br />
We could accomplish this using the <tt>@typedef</tt> annotation or possibly the <tt>@constructor</tt> annotation.<br />
<br />
Additionally, the <tt>@lends</tt> annotation provides a nice way to specify options and configuration for constructing types and will likely make it into an upcoming version of Scripted.<br />
<br />
<h3>So?</h3><br />
Using JSDoc in your JavaScript files is a good way to give some extra help to the inferencer, which often has trouble recognizing some of JavaScript's more dynamic features. Scripted is still in its early stages, and is moving ahead quickly. We like feedback. You can send a message to the <a href="https://groups.google.com/forum/?fromgroups#!forum/scripted-dev">Google group</a> and <a href="https://github.com/scripted-editor/scripted/">fork us on Github</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-69034313058827476152012-07-31T13:02:00.000-07:002012-07-31T13:02:54.676-07:00Using Groovy-Eclipse to make your DSLs more friendlyHere are slides and source code for my talk at <a href="http://gr8conf.us/Presentations/Using-Groovy-Eclipse-to-make-y">GR8Conf US 2012</a>. The source code and slides are available <a href="http://dist.codehaus.org/groovy/distributions/greclipse/GR8ConfUS2012.zip">as a zip</a>.<br />
<br />
You can also access the slides and source code from the <a href="https://github.com/sjurgemeyer/GR8-US-2012">GR8 Conf US 2012 github repository</a>.<br />
<br />
To play with the sample projects and DSL descriptors, you should start with a snapshot version of Groovy-Eclipse 2.7.1 and import the two projects from the zip file into your workspace.<br />
<br />
The best place to get your questions answered is on the <a href="http://xircles.codehaus.org/lists/eclipse-plugin-user@groovy.codehaus.org">Groovy-Eclipse mailing list</a>.<br />
<br />
<iframe src="http://app.sliderocket.com:80/app/fullplayer.aspx?id=a902ce5f-4cb4-45b1-8eb3-5963699c5838" width="500" height="401" scrolling=no frameBorder="1" style="border:1px solid #333333;border-bottom-style:none"></iframe>Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-46435755508709898852012-04-06T19:15:00.000-07:002012-04-06T19:21:47.296-07:00(Slides) Light-weight IDE extensibility for custom DSLs in GroovyHere are my slides from my EclipseCon 2012 talk, <a href="http://contraptionsforprogramming.blogspot.com/2012/03/light-weight-ide-extensibility-for.html">Light-weight IDE extensibility for custom DSLs in Groovy</a>.<br />
<br />
<iframe src="http://app.sliderocket.com:80/app/fullplayer.aspx?id=dbba869e-c9fb-44a2-971c-88541aa60beb" width="500" height="401" scrolling=no frameBorder="0"></iframe><br />
<br />
<b>Update:</b> Uh-oh...looks like the conversion to slide rocket didn't work quite as well as I would have hoped and the animations as well as some of the text is missing. I'm going to see if I can get something better up here.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com1tag:blogger.com,1999:blog-6917071644715743308.post-24008633105117885722012-03-20T13:20:00.000-07:002012-03-20T13:20:25.413-07:00Light-weight IDE extensibility for custom DSLs in GroovyThis post gives a bit of a teaser for my <a href="http://www.eclipsecon.org/2012/sessions/light-weight-ide-extensibility-custom-dsls-groovy">EclipseCon talk</a> next week.<br />
<br />
Most of you reading this probably know that Groovy-Eclipse is the Eclipse tool support for Groovy and one of the major features it provides is <i>type inferencing</i> in the editor. For example, in the following screenshot:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2-wftBt5kCQy5MlpSG9LYDPtfRlarCk2PxdU4fZT0TSF237WgPZhyphenhyphenxI8S-t-XPFzerHJjc4TOohP1WD-RIXVeQFsT1dvqVtxFX3o066l0oHei1hdyuXtOs7VDIuhhSV_4l05yY3OmBr0/s1600/simple_inferencing.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="1"src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2-wftBt5kCQy5MlpSG9LYDPtfRlarCk2PxdU4fZT0TSF237WgPZhyphenhyphenxI8S-t-XPFzerHJjc4TOohP1WD-RIXVeQFsT1dvqVtxFX3o066l0oHei1hdyuXtOs7VDIuhhSV_4l05yY3OmBr0/s320/simple_inferencing.png" /></a></div><br />
Groovy-Eclipse <i>knows</i> that the type of <code>myString</code> is <code>java.lang.String</code>. That is why <code>substring</code> is not underlined, but <code>uh_oh</code> is. All references that cannot be statically resolved are underlined regardless whether or not the program will fail at runtime (Groovy is a dynamic language, and we can't be certain about what happens at runtime).<br />
<br />
This works quite well in common situations. However, things get complicated because Groovy provides strong support for creating domain specific languages (DSLs). Typically, when a DSL is used, the editor will be confused. Consider, for example, <a href="http://joesgroovyblog.blogspot.com/2007/09/and-miles-to-go-before-i-sleep.html">this simple DSL</a> to calculate distances and convert between units. When used in Groovy-Eclipse, the result looks like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5YJDtMFE8pNsjNStyiH5i3Lfjz6f2C0il2iB4K1BvdVvLrgvbT6KbWTHofTj8rwgB7N6WQIXPtQnIHwACTpVQ47NIeumhi48OlYjROLWX4sPPjSEVcBrJZmjo1czg08_MOKtYadSSNZ8/s1600/underlines.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5YJDtMFE8pNsjNStyiH5i3Lfjz6f2C0il2iB4K1BvdVvLrgvbT6KbWTHofTj8rwgB7N6WQIXPtQnIHwACTpVQ47NIeumhi48OlYjROLWX4sPPjSEVcBrJZmjo1czg08_MOKtYadSSNZ8/s400/underlines.png" /></a></div><br />
Uh-oh, underlines. The references do not make sense to the editor, even though this executes without problem.<br />
<br />
Thankfully, Groovy-Eclipse's inferencing engine was designed from the beginning to be extensible. There are three ways to extend the inferencing engine:<br />
<br />
<ol><li>Roll your own Eclipse plugin</li>
<li>Inferencing suggestions</li>
<li>DSL descriptors</li>
</ol><br />
And I'll talk about each of them in the next sections.<br />
<br />
<h3>Roll your own Eclipse plugin</h3><br />
This is a powerful technique and gives you fine-grained control over exactly how your DSL integrates with Groovy-Eclipse. I have already written <a href="http://contraptionsforprogramming.blogspot.com/2009/12/extending-groovy-eclipse-for-use-with.html">a full description</a> of all the extension points available and how to use them to create a plugin that extends Groovy-Eclipse. This was the state of Groovy-Eclipse circa 2010.<br />
<br />
Although there have been many successes with this approach, we found that overall this was quite a heavy-weight way for others to leverage the benefits of type inferencing:<br />
<br />
<ul><li>Most Groovy DSL developers are not Eclipse experts and so do not have the experience or desire to learn Eclipse APIs, create plugins and features, produce an update site, and test it against various versions of Eclipse</li>
<li>Many Groovy programmers (the ones who consume the DSLs) are coming from a scripting world, use vi or textmate, and are used to a light-weight editor. Installing plugins was a big complaint for them. They want things to just <b>work</b></li>
</ul><br />
Clearly, another approach was needed.<br />
<br />
<h3>Inferencing suggestions (<i>very</i> light-weight extensibility)</h3><br />
Inferencing suggestions give the end user control to augment the inferencing engine with specific suggestions. Using a quick-assist (CTRL+1), the user is given an option to add a suggestion to the currently selected identifier in the editor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4doxgdtTZ73PPNIcrHCu9RH7b2qFRwcDtmhQLxhCuHYqnD7h2qQF2-M6uIHneD3lel1CUZM4almvpNWRzvckPiKoEQ2NX0sOHEHfpiQcg5t-YtTOEf7PyOdYl34jiAlXuhiiz5AJdOq4/s1600/add_suggestion_quick_assist.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4doxgdtTZ73PPNIcrHCu9RH7b2qFRwcDtmhQLxhCuHYqnD7h2qQF2-M6uIHneD3lel1CUZM4almvpNWRzvckPiKoEQ2NX0sOHEHfpiQcg5t-YtTOEf7PyOdYl34jiAlXuhiiz5AJdOq4/s400/add_suggestion_quick_assist.png" /></a></div><br />
This brings up the inferencing suggestions dialog, where the user can fill in as little or as many details as desired:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0GgfAlgJ2mwhB7LKysMT33I1pYe39h_ueInUvE4MNqyJv4_LMLcsckaXHGmpHCZZ9nQjAFT4_y3aLAQOuHncmMpNdabNQY8WUcr5NxH9YfRheWY1LSe-u2R3wcUqjhx_bUykkOU29bbo/s1600/inferencing_suggestion.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0GgfAlgJ2mwhB7LKysMT33I1pYe39h_ueInUvE4MNqyJv4_LMLcsckaXHGmpHCZZ9nQjAFT4_y3aLAQOuHncmMpNdabNQY8WUcr5NxH9YfRheWY1LSe-u2R3wcUqjhx_bUykkOU29bbo/s400/inferencing_suggestion.png" /></a></div><br />
And now, back in the editor, the suggestion is now used for inferencing:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0fd4qPmv8GAWllR5FZhZsTnp2xhL8lHWRsoZVVjWISY5rIY9s80mqf7QDsJ6qG5Loy5MULeIYCWywzJwOkQPkTWknBZC_JmEPAPE1_0Kqigs9JX2mhrGhRd0CEb3srdVT_aCrFu_teqg/s1600/suggestions_hover.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0fd4qPmv8GAWllR5FZhZsTnp2xhL8lHWRsoZVVjWISY5rIY9s80mqf7QDsJ6qG5Loy5MULeIYCWywzJwOkQPkTWknBZC_JmEPAPE1_0Kqigs9JX2mhrGhRd0CEb3srdVT_aCrFu_teqg/s400/suggestions_hover.png" /></a></div><br />
This feature has some big advantages over the plugin model:<br />
<br />
<ul><li>it gives end-users more control over their own environment</li>
<li>it is dead simple to use and no other plugins are required</li>
<li>no need for any Eclipse API knowledge</li>
<li>little knowledge of Groovy required</li>
</ul><br />
But in some situations, this feature moves too far in the direction of simplicity over expressiveness.<br />
<br />
<ul><li>can only target a single property/method at a time, which makes large DSLs painful to work with</li>
<li>not easy to share across users and projects</li>
</ul><br />
Inferencing suggestions was not sufficient and we needed yet another kind of extensibility.<br />
<br />
<h3>DSL descriptors (light-weight extensibility)</h3><br />
A DSL descriptor (DSLD) is a Groovy script that describes your Groovy DSL. This script is compiled and executed by Groovy-Eclipse so that the inferencing engine can understand the DSL. They can be shipped with libraries and as long as Groovy-Eclipse can find these files on the classpath, they can contribute to type inferencing. I have already written <a href="http://blog.springsource.org/2011/05/08/better-dsl-support-in-groovy-eclipse/">a good introduction to DSLD</a>.<br />
<br />
We created the DSLD language so that library developers could have fine-grained control over how their library and DSL gets interpreted in Groovy-Eclipse and also so that end users can transparently use this functionality without needing to install a new plugin or do any extra work. <br />
<br />
Taking our distances DSL from before, we can write a simple DSLD that encapsulates the DSL in a format consumable by Groovy-Eclipse:<br />
<br />
<pre>contribute( currentType( subType( Number ) ) ) {
[ “m”, “yd”, “cm”, “mi”, “km” ].each {
property name:it, type:"Distance”,
doc: """Converts a {@link Number} to a <code>{$it}</code>
@author Joe
@since 1.0"""
}
}
</pre><br />
When this file is saved to something like <code>distances.dsld</code> and placed in the project or on the classpath, the distances expression is appropriately recognized in the editor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0fd4qPmv8GAWllR5FZhZsTnp2xhL8lHWRsoZVVjWISY5rIY9s80mqf7QDsJ6qG5Loy5MULeIYCWywzJwOkQPkTWknBZC_JmEPAPE1_0Kqigs9JX2mhrGhRd0CEb3srdVT_aCrFu_teqg/s1600/suggestions_hover.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0fd4qPmv8GAWllR5FZhZsTnp2xhL8lHWRsoZVVjWISY5rIY9s80mqf7QDsJ6qG5Loy5MULeIYCWywzJwOkQPkTWknBZC_JmEPAPE1_0Kqigs9JX2mhrGhRd0CEb3srdVT_aCrFu_teqg/s400/suggestions_hover.png" /></a></div><br />
(Which, you should notice looks the same as the inferencing suggestions hover above.)<br />
<br />
<h3>What kind of extensibility is best?</h3><br />
That's a loaded question and of course, it depends. Here's a simple table to highlight the costs and benefits of each approach:<br />
<br />
<table border="1"><th style="background:#e6dede"><td style="background:#e6dede">Extension points</td><td style="background:#e6dede">DSLD</td><td style="background:#e6dede">Inferencing suggestions</td></th>
<tr><td style="background:#e6dede">Ease</td><td>heavy-weight</td><td>light-weight</td><td><i>very</i> light-weight</td></tr>
<tr><td style="background:#e6dede">Flexibility</td><td>lots</td><td>some</td><td>little</td>
<tr><td style="background:#e6dede">Eclipse knowledge required?</td><td>lots</td><td>none</td><td>none</td></tr>
<tr><td style="background:#e6dede">Groovy knowledge required?</td><td>lots</td><td>lots</td><td>little</td></tr>
<tr><td style="background:#e6dede">How to use/install</td><td>update site</td><td>included with library</td><td>preferences/quick-assist</td></tr>
</table><br />
I'd still recommend that you come see <a href="http://www.eclipsecon.org/2012/sessions/light-weight-ide-extensibility-custom-dsls-groovy">the talk at EclipseCon</a> (if you are lucky enough to be attending the conference). I'll go into more detail on implementation and I'll show some live demos on how this all works. See you at EclipseCon!Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com2tag:blogger.com,1999:blog-6917071644715743308.post-41368147634993136982012-02-24T13:32:00.000-08:002012-02-24T13:32:35.938-08:00Better JavaScript content assist in Eclipse OrionEven in the month since I started using and working on Eclipse Orion, there have been significant improvements to it. The UI is getting cleaned up, navigation is getting easier, git integration is progressing, and search is improving. It's great to be contributing to such a fast moving project, even if the rate of change can be dizzying sometimes. Also, I'm new to JavaScript and I have never worked on such a large code-base written in a dynamic language. One of the things that I have been missing the most is good tool support that really knows about the code you are working on. Traditional IDEs set the bar high in this area.<br />
<br />
I'm happy to introduce a small step in the direction of making the JavaScript editor smarter. I've just released an Orion plugin that provides semantically aware content assist in the JavaScript editor. The plugin uses the <a href="http://esprima.org">Esprima JavaScript parser</a> with some extra error recovery added by <a href="https://twitter.com/#!/andy_clement">Andy Clement</a>. I have found the Esprima parser to be fast, clean, and easy to use and using it as the core of the content assist plugin has been the right thing to do, even though this project, too, is fast moving and hard to keep up with.<br />
<br />
<h3>How it works</h3><br />
Like content assist in Java editors in Eclipse, the Esprima content assist plugin is based off of a semantically rich abstract syntax tree (AST) and so content assist proposals are more likely to be relevant than if we were using a lexical approach to content assist. Here is what happens:<br />
<br />
<ol><li>On a content assist invocation, the contents of the buffer are parsed by Esprima.</li>
<li>The resulting AST is walked by the content assist plugin.</li>
<li>While walking the AST, the target type of any AST node is recorded as well as assignments and declarations. This information helps us keep track of what properties are available on each known type at any given point in the AST.</li>
<li>After walking a sufficient amount of the AST (we don't need to walk the entire tree since parts of it are not going to be relevant for a given content assist invocation), all available proposals are calculated based on the target type of the invocation offset and the prefix.</li>
</ol><br />
The best way to understand how this works is through examples.<br />
<br />
<h3>What it can do</h3><br />
<h4>Recognizing function scopes</h4><br />
As you can see in this screenshot, scoping is respected and identifiers that are not accessible in the current scope (vInnerInner, v3, v4,…) are not shown in content assist.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBSxCIVEkV0LEIVSCOngl4J6WrCD_rL0qbetwk_mswSkw-BwEJ805ywZ0gF4lKBzgHX_7x2lVtnXypadHpZOqkDQdv7R3hil1LFeWLaujD7hfVP9m6sGBgfMFl-SNm1fWrjnk21bTQTv0/s1600/1scopes.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="209" width="283" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBSxCIVEkV0LEIVSCOngl4J6WrCD_rL0qbetwk_mswSkw-BwEJ805ywZ0gF4lKBzgHX_7x2lVtnXypadHpZOqkDQdv7R3hil1LFeWLaujD7hfVP9m6sGBgfMFl-SNm1fWrjnk21bTQTv0/s320/1scopes.png" /></a></div><br />
<h4>Object literals</h4><br />
The key/values of object literals are appropriately proposed:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG7Ap3qOme1sM8d1H9UTZfbhsLP9Xy_xAud5xA3UD1qkFFY83B9V_JBlKXU5O5QM0FUf6WQHzKMNfpG7N0kjmBaG6AyRMqMlzxbH149ugVIL-HZ_guaW-ZKmg_shDLxGsD0OgF453MM6E/s1600/2obj_lit.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="131" width="176" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG7Ap3qOme1sM8d1H9UTZfbhsLP9Xy_xAud5xA3UD1qkFFY83B9V_JBlKXU5O5QM0FUf6WQHzKMNfpG7N0kjmBaG6AyRMqMlzxbH149ugVIL-HZ_guaW-ZKmg_shDLxGsD0OgF453MM6E/s320/2obj_lit.png" /></a></div><br />
Even nested object literals are recognized:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJH5duUOsIcjNnWLk1u7LU4dHcvGpMURcj0CpFgItD_4otyrC1Y1KaSrq-TCNQLxgvGiUrpUlIJu6ZcwPnv9zpKBR3u_rkvyJmBMhdaQUAJG3RdQe00Z6lEcmthCJqiUoAyMdIMjKVV30/s1600/3obj_lit.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="147" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJH5duUOsIcjNnWLk1u7LU4dHcvGpMURcj0CpFgItD_4otyrC1Y1KaSrq-TCNQLxgvGiUrpUlIJu6ZcwPnv9zpKBR3u_rkvyJmBMhdaQUAJG3RdQe00Z6lEcmthCJqiUoAyMdIMjKVV30/s320/3obj_lit.png" /></a></div><br />
<h4>Simple control flow</h4><br />
Simple control flow is recorded by the plugin, so that assignments are remembered:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYB_Fln1ER5xbpvhQV80Szwdgbd3JhbRca-OmHgdkkznFxAMZDEsxxM7V_BgVQy6J4wz2U0ngomplTc4w6HTjMBR49Sa3pZhyphenhyphenYX1B5s0RsVI8UjRcW7IDMplZ-UYLrWDQAmhLUg9vviIs/s1600/4control_flow.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="136" width="199" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYB_Fln1ER5xbpvhQV80Szwdgbd3JhbRca-OmHgdkkznFxAMZDEsxxM7V_BgVQy6J4wz2U0ngomplTc4w6HTjMBR49Sa3pZhyphenhyphenYX1B5s0RsVI8UjRcW7IDMplZ-UYLrWDQAmhLUg9vviIs/s320/4control_flow.png" /></a></div><br />
<h4>Pre-defined types</h4><br />
Some (but not all) predefined types are available in content assist. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMGAh1Hsuq2qfEdk4Dmr85nJv32FZ8zZwP_Ho9QF46pLB3nRyEi8-1tRdpkrocO5bFHMyNTzbYacu3YgA4kIl5efYS2cDx3BKTJptuDqTVy-Q8JY61c3qZ3FD86Wdl2FBv_M1OU_7TLOo/s1600/5predefined.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="46" width="203" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMGAh1Hsuq2qfEdk4Dmr85nJv32FZ8zZwP_Ho9QF46pLB3nRyEi8-1tRdpkrocO5bFHMyNTzbYacu3YgA4kIl5efYS2cDx3BKTJptuDqTVy-Q8JY61c3qZ3FD86Wdl2FBv_M1OU_7TLOo/s320/5predefined.png" /></a></div><br />
Currently, the plugin recognizes <code>JSON</code>, <code>MATH</code>, <code>Number</code>, <code>String</code>, <code>Boolean</code>, and <code>Date</code>, but I will probably add more as it makes sense.<br />
<br />
<h4>Constructors</h4><br />
Functions that start with capital letters are considered constructors<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmYibVk9vY14gk9yDq_qZr4qFG3tyD1mAdvrQvEnZeApAN-ijSulrhWzikcnZgY1-Le-TfWOCyzt2YvcRDAKHjNSGQeOCcAJrjSWC5eoecyuhgE6CZN6RbshieOhZEFWymfXD01JGVjW0/s1600/6ctor.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="159" width="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmYibVk9vY14gk9yDq_qZr4qFG3tyD1mAdvrQvEnZeApAN-ijSulrhWzikcnZgY1-Le-TfWOCyzt2YvcRDAKHjNSGQeOCcAJrjSWC5eoecyuhgE6CZN6RbshieOhZEFWymfXD01JGVjW0/s320/6ctor.png" /></a></div><br />
<h4>Parser recovery</h4><br />
Finally, Andy Clement has been doing some work on making the esprima parser recoverable from errors. Actually, some error recovery is already in esprima, but we need to tweak it a bit for content assist. Hopefully, this work can be contributed back to esprima after we have a good solution. Currently, the recovery work is focussed on errant dots. A common case is that you will type a variable name and then a '.' and expect content assist to provide all reasonable answers. Most JavaScript parsers will fail after the first error, which makes them quite useless when editing code.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNabbeBMlYHa0xP2jcoy4rDHMCnrOIT8dNxS8XcNKy-XHN-vf5p1P-RQ_ohvLEwDJksYdDbS0hX4OowhRMkUrKelkLtJ9P2OFgeTbRpQfJ8Vvi16z13DBITp_9XS-Hl7zo0lv4gmW65d8/s1600/7recovery.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="192" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNabbeBMlYHa0xP2jcoy4rDHMCnrOIT8dNxS8XcNKy-XHN-vf5p1P-RQ_ohvLEwDJksYdDbS0hX4OowhRMkUrKelkLtJ9P2OFgeTbRpQfJ8Vvi16z13DBITp_9XS-Hl7zo0lv4gmW65d8/s320/7recovery.png" /></a></div><br />
As you can see in the screenshot, despite all of the funky dots, the plugin is able to realize that myVar is of type Number and is providing appropriate proposals.<br />
<br />
<h3>What it can't do (yet)</h3><br />
This is still early for the content assist plugin and there is quite a bit of work to do. For example:<br />
<br />
<ol><li>There is no pre-defined window object, which probably should be there, along with possibly other predefined objects, like dojo, dijit, and $ (jquery).</li>
<li>There is no analysis of function return types</li>
<li>No inter-file type inferencing, which will be crucial for getting anything really smart working</li>
<li>The plugin should recognize /*global */ comments</li>
<li>The Esprima-based proposals are currently intermingled with proposals from the default JS content assist plugin and so duplicates appear. (Esprima proposals are always prefixed with a handle (Esprima) so you know where they come from, but they are always on the bottom).</li>
</ol><br />
I hope to deal with each of these issues eventually, but I also need to make sure that performance remains reasonable, which it currently seems to be, but is something I need to watch.<br />
<br />
<h3>How to get it</h3><br />
<a href="http://regrettable-hacks.blogspot.com/">Mark Macdonald</a> has already added the pluign to the Orion plugin page, so after you log into Orion, click to the "Get Plugins" link and select the Install link for the Esprima content assist plugin:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRzXFRZlzDLcd9RfpfUdJ6OO23Z6W6-VjtZBXKScxA_sfLRyT7tftEyCnQvpVXTsjQQiDC7akOcD1kuT4QwpxvbPj1KcagR8uIJ2NW1CG8_CyUFXC7VsIPDNoiRvu5vwX6kVcdL8v1Bd0/s1600/8install.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRzXFRZlzDLcd9RfpfUdJ6OO23Z6W6-VjtZBXKScxA_sfLRyT7tftEyCnQvpVXTsjQQiDC7akOcD1kuT4QwpxvbPj1KcagR8uIJ2NW1CG8_CyUFXC7VsIPDNoiRvu5vwX6kVcdL8v1Bd0/s320/8install.png" /></a></div><br />
The github page is located here: https://github.com/aeisenberg/esprimaContentAssist so try it out, have a look at the code and let me know what you think!Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com9tag:blogger.com,1999:blog-6917071644715743308.post-50589959397820934972011-11-16T20:42:00.001-08:002011-11-16T21:01:26.983-08:00First ever Vancouver Eclipse Hackathon...success!Last night we had our first Vancouver Eclipse Hackathon. It was a wonderful night, and we had 20 Eclipse hackers showing up with all kinds of experience. The goal of the evening was to introduce some programmers to Eclipse-based open source projects, to help them collaborate and learn about the project, and maybe even contribute some code. Some hackers had written Eclipse plugins before, others knew nothing about Eclipse (other than it being a great Java IDE), and a few didn't even know Java. It was a good range of people and we spent almost six hours working on our bugs. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDr-F1dqZaNXI5gjrpNNDB3kFr8U0t-WhwKzFRi4gpp3hIrGc9QZyJnVPKDFdavfjDQbmb4gmv5bteZitgQ_37d-SeujFyxz52GEOPJUQlVfwVSyJluhdVmH9LYZb1UYcRpLViZS36pqs/s1600/photo+%25283%2529.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="239" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDr-F1dqZaNXI5gjrpNNDB3kFr8U0t-WhwKzFRi4gpp3hIrGc9QZyJnVPKDFdavfjDQbmb4gmv5bteZitgQ_37d-SeujFyxz52GEOPJUQlVfwVSyJluhdVmH9LYZb1UYcRpLViZS36pqs/s320/photo+%25283%2529.JPG" /></a><br />
Working on quick-assists inside of Groovy-Eclipse<br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR-ZXuDZINU3Sc4KLrsDAKBq2eoMfWWuH1QIQLbeq7ICPXskJUJgKVC_TTotgfidiBkV-SNyQPB8RGRYsFDtEiCXux4K3rfD-nIjKvE8LWGiU_eEZygWC6Nr1Jh2Xnhxxhkfaaz17aXAE/s1600/photo+%25284%2529.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="239" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR-ZXuDZINU3Sc4KLrsDAKBq2eoMfWWuH1QIQLbeq7ICPXskJUJgKVC_TTotgfidiBkV-SNyQPB8RGRYsFDtEiCXux4K3rfD-nIjKvE8LWGiU_eEZygWC6Nr1Jh2Xnhxxhkfaaz17aXAE/s320/photo+%25284%2529.JPG" /></a><br />
Team working on mark-occurrences in the Groovy editor.<br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVnxU2OK_OhKuEhE6zyoeR3LrGSM2lSmxdsVJGuqQEg3-acL7ZUKv_Ce0anRcdcF8Cb75dL9lqMhDww-gO3tEPCuNQj__w1BnfRONpizOQK79A__ednHdIVvJsJiGVuU1CIdwKPNuh66w/s1600/photo4.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="240" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVnxU2OK_OhKuEhE6zyoeR3LrGSM2lSmxdsVJGuqQEg3-acL7ZUKv_Ce0anRcdcF8Cb75dL9lqMhDww-gO3tEPCuNQj__w1BnfRONpizOQK79A__ednHdIVvJsJiGVuU1CIdwKPNuh66w/s320/photo4.JPG" /></a><br />
Some Mylyn Hackers working together.</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_QMmChMRwawbxhMj-OK1G8UboUIszbPWxw1lHeW2x1d2lCDwVRx-0k-QshbkbgCtDrfA6nRhGEWb2tqo-GPfxbYROD9g56FygYKahlRiPIjozxewoVb8oU_FHDSn6iaGSHbkn7qiuOU4/s1600/photo5.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="240" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_QMmChMRwawbxhMj-OK1G8UboUIszbPWxw1lHeW2x1d2lCDwVRx-0k-QshbkbgCtDrfA6nRhGEWb2tqo-GPfxbYROD9g56FygYKahlRiPIjozxewoVb8oU_FHDSn6iaGSHbkn7qiuOU4/s320/photo5.JPG" /></a><br />
More hacking.<br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUOj3V0nmsBG2xfa0xOBzRN3whpBPvlMjLzyR6hmQhUzg3qIiK92dp82rmcGugqEbMm5Ub2tw_NLH8VAPWK6ZcjTKSoBykY0Y1_oij44-nVA-fniDY2PRV1z8HJYuwig8PUVSOmCB2hF8/s1600/photo+%25285%2529.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="239" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUOj3V0nmsBG2xfa0xOBzRN3whpBPvlMjLzyR6hmQhUzg3qIiK92dp82rmcGugqEbMm5Ub2tw_NLH8VAPWK6ZcjTKSoBykY0Y1_oij44-nVA-fniDY2PRV1z8HJYuwig8PUVSOmCB2hF8/s320/photo+%25285%2529.JPG" /></a><br />
Almost complete silence in the room as everyone concentrates on their bugs.<br />
</div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPY05sBY4z22VQQNnTvdik-ZhqWp9uUUubFmjmlCaZ4biczVdQBRghJv8FZlLWpgJbQYtMpcfofRElqFZQSARhuEglHWaKR5oZJYygX6HhVG5-B9ZO-WiWkd7Zqx428K21Dr2pzaR9kNA/s1600/photo8.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="240" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPY05sBY4z22VQQNnTvdik-ZhqWp9uUUubFmjmlCaZ4biczVdQBRghJv8FZlLWpgJbQYtMpcfofRElqFZQSARhuEglHWaKR5oZJYygX6HhVG5-B9ZO-WiWkd7Zqx428K21Dr2pzaR9kNA/s320/photo8.JPG" /></a><br />
Happy birthday, Eclipse!<br />
</div><br />
And here are the results of the evening:<br />
<br />
<ul><li>20 hackers (including two project leads)</li>
<li>6 hours of hacking</li>
<li>24 bottles of beer drunk</li>
<li>6 pizzas eaten</li>
<li>Half of an Eclipse 10 year birthday cake eaten</li>
<li>3 Eclipse-based projects worked on: Mylyn, AJDT, and Groovy-Eclipse</li>
<li>12 bugs worked on</li>
<li>3 patches submitted</li>
<li>2 more patches in process</li>
<li>Fun had by all</li>
</ul><br />
It was encouraging to see the dedication of all the hackers. We will definitely be hosting another one soon. However, we did learn a few things about organizing hackathons that we will do differently next time:<br />
<br />
<ul><li>Make it easy for hackers to set up their dev environments. Put up instructions a few days before so hackers can get ready before the hackathon and they don't have to spend 90 minutes setting up before starting.</li>
<li>Internet connections can be unreliable and slow. Have USB sticks available with Eclipse SDK tarballs for different environments. Also, have some workspaces set up with the source code of the projects checked out.</li>
<li>Try to have more projects and more project leads available. This time, we only had three projects and two project leads, but more variety would have been nicer. We were originally expecting more leads to show up, but they had to cancel.</li>
<li>Have a very concise list of bugs for hackers to work on. Be very specific about how to get started working on them.</li>
</ul><br />
Also, a huge thanks to the other co-organizers of this event Ducky Sherwood and Zoe Jong from <a href="http://tasktop.com">Tasktop Technologies</a>.<br />
<br />
If you want to organize a hackathon in your area, drop me a line and I can help you get started. It is a fun time.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-84165930807001617512011-09-22T20:00:00.000-07:002011-09-22T20:00:03.445-07:00Using Grails 2.0.0.M2, Cloud Foundry and the SpringSource Tool SuiteThere are a lot of details in my <a href="http://www.meetup.com/VanDev/events/29040211/">VanDev talk</a> tonight. Since most of what I showed you was from versions of our software not yet officially released, you are going to need to cobble together a few things to get everything working properly. Here are some instructions and links.<br />
<br />
<ol><li>First, here is a detailed guide on <a href="http://static.springsource.org/sts/docs/2.7.0/reference/html/grails/grails20.html">using Grails 2.0.0 from inside STS</a>. It was written for M1, but it is essentially the same. Below, I'll summarize.</i><br />
<li><a href="http://www.springsource.com/landing/best-development-tool-enterprise-java">Download STS 2.8.0.M1</a>. To see 2.8.0.M1, you need to click on <i>Other downloads</i>.</i><br />
<li>After downloading and unzipping/installing STS, you will need to install Groovy-Eclipse and Grails Tooling. <b>Do not</b> install Groovy-Eclipse or Grails from the dashboard since that only points to older releases. Instead, go to the Install manager (Help -> Install new software...), and add the nightly update sites for Groovy-Eclipse and Grails Tooling:<br />
<ul><li>Nightly Grails Tooling update site:<br />
<b>http://dist.springsource.com/snapshot/TOOLS/nightly/e3.7</b></li>
<li>Nightly Groovy-Eclipse update site. Make sure to also install the Groovy 1.8 compiler:<br />
<b>http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/</b></i><br />
</ul>
Use these sites to install the software.</i>
<li>Next, <a href="http://grails.org/Download">download Grails 2.0.0.M2</a>.</i><br />
<li>Once downloaded and unzipped, you can install the Grails distribution into STS.</i><br />
</ol>
If you want to play around with Cloud Foundry:
<ol><li>First install the CloudFoundry tools from the STS dashboard.</i><br />
<li>Then sign up for a <a href="http://cloudfoundry.com/">CloudFoundry account</a>.</i><br />
<li>There's lots of information on the cloudfoundry.com site as well as the <a href="http://cloudfoundry.org.">community site</a>. Here's more on using <a href="http://blog.springsource.com/2011/04/13/using-cloud-foundry-from-sts/">Cloud Foundry in STS</a></i><br />
</ol>
Here is some more information on <a href="http://blog.springsource.com/2011/05/08/better-dsl-support-in-groovy-eclipse/">DSL Descriptors</a> in Groovy-Eclipse, and also a general description of our approach to <a href="http://blog.springsource.com/2009/07/30/a-groovier-eclipse-experience/">integrating the Groovy and Java compilers</a> inside of Groovy-Eclipse.
<h3>Support</h3>
If you have any questions of problems with STS or Groovy-Eclipse, <a href="http://forum.springsource.org/forumdisplay.php?32-SpringSource-Tool-Suite">please visit the forum</a>. However, Groovy-Eclipse questions may be answered more quickly on <a href="http://xircles.codehaus.org/lists/eclipse-plugin-user@groovy.codehaus.org">the mailing list</a>. Bugs can be reported here: <a href="http://jira.codehaus.org/browse/GRECLIPSE">Groovy-Eclipse</a> and <a href="https://issuetracker.springsource.com/browse/STS">STS</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-85435027129596862922011-06-29T12:30:00.000-07:002011-06-29T12:30:23.892-07:00AJDT 2.1.3 ReleasedThe AJDT team is proud to release AJDT 2.1.3. This release is the first one targeting Indigo (Eclipse 3.7) and it contains <a href="http://eclipse.org/aspectj/doc/released/README-1612.html">AspectJ 1.6.12.M1</a>. The update sites are here:<br />
<br />
For Indigo:<br />
<code>http://download.eclipse.org/tools/ajdt/37/update</code><br />
<br />
For Helios:<br />
<code>http://download.eclipse.org/tools/ajdt/36/update</code><br />
<br />
Please send any feedback to one of the mailing lists or raise an issue<br />
on <a href="http://bugs.eclipse.org/">Bugzilla</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-75278736468101456882011-06-29T11:15:00.000-07:002011-06-29T11:15:04.631-07:00Groovy-Eclipse 2.5.1 ReleasedThe Groovy-Eclipse team is proud to release Groovy-Eclipse 2.5.1. This release is now available for install using the update sites here:<br />
<br />
for Eclipse Indigo:<br />
<pre>http://dist.springsource.org/release/GRECLIPSE/e3.7/</pre><br />
for Eclipse Helios:<br />
<pre>http://dist.springsource.org/release/GRECLIPSE/e3.6/</pre><br />
In this release, we have continued to work on our DSLD support (and we<br />
ship with some useful DSLD scripts). Additionally, we have a GA<br />
release of the groovy-eclipse-compiler-plugin for Maven. Now that<br />
Indigo has been released, the 3.7 stream of Groovy-Eclipse will become<br />
the main development branch. For now, we will continue to support the<br />
3.6 stream of Groovy-Eclipse and will put out at least one more<br />
release.<br />
<br />
You can find all the details at our <a href="http://groovy.codehaus.org/Groovy-Eclipse+2.5.1+New+and+Noteworthy">New & Noteworthy page</a>.<br />
<br />
Please send feedback here or raise an issue on our <a href="http://jira.codehaus.org/browse/GRECLIPSE">issuetracker</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com2tag:blogger.com,1999:blog-6917071644715743308.post-55204293955751307572011-06-24T11:42:00.000-07:002011-06-24T14:01:29.678-07:00Vancouver Eclipse Demo Camp 2011In honor of the <a href="http://eclipse.org/indigo/">Indigo release of Eclipse</a>, I will be hosting the annual Eclipse Demo camp in Vancouver on Monday, June 27. The demo camp is co-sponsored by the <a href="http://eclipse.org">Eclipse Foundation</a>, <a href="http://vmware.com">VMWare</a>, and <a href="http://tasktop.com">Tasktop</a>.<br />
<br />
We're expecting a full house as well as lots of exciting talks, including one on Groovy/Grails support in Eclipse and the SpringSource Tool Suite, a talk from Tasktop, and a talk about the <a href="http://eclipse.org/emf">Eclipse Modelling Framework</a> from Ed Merks, the project lead.<br />
<br />
If you are in the Vancouver area and interested in attending, please add your name to the wiki:<br />
<br />
http://wiki.eclipse.org/index.php?title=Eclipse_DemoCamps_Indigo_2011/Vancouver<br />
<br />
Alternatively, contact me directly (or on this blog) and I'll add you myself. Hope to see you there!Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com2tag:blogger.com,1999:blog-6917071644715743308.post-10304325464560252622011-05-24T20:52:00.000-07:002011-05-24T20:54:51.938-07:00Slides from Gr8conf Europe 2011Here are the slides from my <a href="http://www.eu2011.gr8conf.org/talk/sts">Gr8Conf Europe presentation</a>.<br />
<br />
<div style="width:425px" id="__ss_8090287"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/werdnagreb/better-dsl-support-for-groovyeclipse" title="Better DSL Support for Groovy-Eclipse">Better DSL Support for Groovy-Eclipse</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/8090287" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> <div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/werdnagreb">Andrew Eisenberg</a> </div></div><br />
Unfortunately, the animations didn't make the conversion to SlideShare, but these slides will give you an idea of what I talked about. I can also post the sample projects that I showed during the talk.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-78208849776440427392011-05-12T09:19:00.000-07:002011-05-13T13:30:48.347-07:00Groovy-Eclipse 2.5.0 ReleasedThe SpringSource Tools Team is proud to release Groovy-Eclipse 2.5.0. In this release, we are most proud of our new <a href="http://blog.springsource.com/2011/05/08/better-dsl-support-in-groovy-eclipse/">DSL Descriptors</a> (DSLDs) feature, which provides scriptable support for custom Domain Specific Languages in the Groovy Editor. Additionally, this release includes Groovy 1.8 as an optional add on, better content assist and type inferencing, and a Groovier outline view. <br />
<br />
See all details on the <a href="http://docs.codehaus.org/display/GROOVY/Groovy-Eclipse+2.5.0+New+and+Noteworthy">New and Noteworthy page</a>, and please send your comments to <a href="http://xircles.codehaus.org/manage_email/eclipse-plugin-user@groovy.codehaus.org">the mailing list</a>. Enjoy!Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-9255325561140542162011-05-09T10:41:00.000-07:002011-05-09T10:41:35.765-07:00Better DSL Support for Groovy-EclipseWhat have I been doing lately? Mostly working on Groovy-Eclipse's new DSLD feature to support custom Groovy DSLs more easily. See my post about that on the <a href="http://blog.springsource.com/2011/05/08/better-dsl-support-in-groovy-eclipse/">SpringSource blog</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-78081393449932959952011-04-08T21:11:00.000-07:002011-04-08T21:11:19.624-07:00Next month at the GR8 conferenceThe nice folks organizing the GR8 Conference 2011 Europe have posted an interview they did with me. You can read it <a href="http://www.gr8conf.org/blog/2011/04/06/92">here</a>. The GR8 conference focusses on the Groovy eco-system including Grails, Gradle, and Griffon.<br />
<br />
I'll be talking about Groovy-Eclipse, Grails tooling, and our new Gradle support for Eclipse. More on this soon...Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-88552229247045106792011-03-18T09:25:00.000-07:002011-03-18T09:29:24.841-07:00Groovy-Eclipse and AJDT simultaneous releasesToday, we have just release Groovy-Eclipse 2.1.2 and AJDT 2.1.2. By coincidence, they both have the same version number.<br />
<br />
<h3>Groovy-Eclipse</h3><br />
We've made lots of improvements to Groovy-Eclipse including inline renaming support, mark/find occurrences as you type, and type inferencing improvements. You can find all the details at the <a href="http://docs.codehaus.org/display/GROOVY/Groovy-Eclipse+2.1.1RC1+New+and+Noteworthy">New and Noteworthy</a> page.<br />
<br />
The update site for installation on Eclipse 3.6 is here:<br />
<br />
<a href="http://dist.springsource.org/milestone/GRECLIPSE/e3.6/">http://dist.springsource.org/milestone/GRECLIPSE/e3.6/</a><br />
<br />
We are also now releasing a Groovy-Eclipse for Eclipse 3.7 (Indigo). The update site is here:<br />
<br />
<a href="http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/">http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/</a><br />
<br />
As always, please raise bug reports and enhancement requests at our <a href="http://jira.codehaus.org/browse/GRECLIPSE">Codehaus issue tracker</a>.<br />
<br />
We expect to release Groovy 1.8 support shortly.<br />
<br />
<h3>AJDT</h3><br />
Our enhancements for AJDT have mostly centered around supporting Intertype Inner Types. a new AspectJ language feature. You can read about it at the <a href="http://eclipse.org/ajdt/whatsnew212">AJDT New and Noteworthy</a>.<br />
<br />
An AJDT release for Eclipse 3.7 is available at this update site:<br />
<br />
<a href="download.eclipse.org/tools/ajdt/37/dev/update/">download.eclipse.org/tools/ajdt/37/dev/update/</a><br />
<br />
Please raise bugs and feature requests at <a href="https://bugs.eclipse.org/bugs/">Eclipse's bugzilla</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-22826296319497545892011-03-07T20:03:00.000-08:002011-03-07T20:23:05.768-08:00eGit in practiceI like Git in theory. Distributed version control has many advantages over non-distributed including local branching, easier task switching, and easier offline work. However, as an Eclipse user, I find it highly disruptive to drop down to the command line whenever I need to perform any git commands. Despite its advantages, using git instead of CVS or SVN has felt like a big step backward because of its lack of Eclipse tooling.<br />
<br />
Until now, I have only been using git occasionally, and so I could live with the inconvenience. However, it looks like some of my major projects will be moving to git and so I need to figure out what to do. I have been eagerly awaiting the <a href="http://eclipse.org/egit">eGit</a> tooling to reach a reasonable level of maturity. I decided to try it out and see how far along it is.<br />
<br />
<br />
<h3>Install and setup</h3><br />
<br />
I installed eGit 0.11.3 from the public repository (<a href="http://download.eclipse.org/egit/updates">http://download.eclipse.org/egit/updates</a>) into my SpringSource Tool Suite. And as expected, the Git Repository perspective was initially empty. So far so good.<br />
<br />
I thought I'd start by cloning the <a href="http://marketplace.eclipse.org/content/spring-ide">SpringIDE project</a>. Initially, I tried right clicking in the <em>Git repositories</em> view, and expected that I'd be able to pasted the repository URL directly. That didn't work. There is only one option: to paste an existing repository path:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSvavtnPeSfjWWkYvfBgJB2XZhGKrbv6rIgikcn1Po_iWtS5P5Ld0jd5d33NaV5sjKBSn1gKa3PTlhOUxl3JxmrmKKiRObfjeRERT_AdvFHxuJ3Zt-slO8H2RZbZoQg3eGmljBCSTgSD8/s1600/cant_clone.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSvavtnPeSfjWWkYvfBgJB2XZhGKrbv6rIgikcn1Po_iWtS5P5Ld0jd5d33NaV5sjKBSn1gKa3PTlhOUxl3JxmrmKKiRObfjeRERT_AdvFHxuJ3Zt-slO8H2RZbZoQg3eGmljBCSTgSD8/s320/cant_clone.png" width="320" /></a></div><br />
<br />
Instead, I used the "clone repositories" command button. I was able to do what I wanted to, but it was slightly less intuitive than I would have hoped. <br />
<br />
<h3>Using eGit</h3><br />
After cloning, Git placed the entire repository on my hard drive, which is nice because checking out, exploring, and comparing is much faster than using a traditional VCS. Performing these operations within Eclipse is just as speedy as doing things like comparing local history. At this point, I was very impressed.<br />
<br />
Then I made a single change to a file and things started going downhill. After the change, I had to wait about 30 seconds for the '>' to appear in the package explorer next to the changed file (whereas with <a href="http://eclipse.org/subversive">Subversive</a> and the CVS tooling, this happens what seems like instantaneously):<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5DQeZtjsl54_bS_aSiOeN6_pbmSQMvTSJGPpV_av643OiEfmIp3u3DTJbaryUS_LJV12QeBS-EbR7S6VIqVvMYDbGqB1qIuAPYyDlexBMl7706uYabwQw-RQ8A3N_ZHY94HoI8feSzv0/s1600/file_change.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5DQeZtjsl54_bS_aSiOeN6_pbmSQMvTSJGPpV_av643OiEfmIp3u3DTJbaryUS_LJV12QeBS-EbR7S6VIqVvMYDbGqB1qIuAPYyDlexBMl7706uYabwQw-RQ8A3N_ZHY94HoI8feSzv0/s1600/file_change.png" /></a></div><br />
Then I started playing around... I right-clicked on the file I had just changed and selected <em>Assume unchanged</em>. Uh-oh! <a href="http://pastebin.com/bzxaeEnx">ClassCastException</a>. Now, click <em>Assume changed</em>. <a href="http://pastebin.com/fUk7j46b">IOException</a>. Apparently, though something worked and I was able to continue with the commit and then view the commit in history.<br />
<br />
Next problem: I moved back to the Git Repositories perspective, and I had lost all of the git repositories in the git repositories view. Re-importing them would not work. It looked more like the UI had crashed than any data had been lost:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEWaZLJVt3UkTgTYUcBgRfP9jWivijLC-5vURYCq9mwS6GAR_lVymdsjj_x_J0UYizqCzv22cbtorlzp2zm_aQeFhd6IrHWhuVoUhSr9gzcMz-dDJvbJVzJc4JlsoDcRDVB-lvnWtHbtM/s1600/missing_repos.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEWaZLJVt3UkTgTYUcBgRfP9jWivijLC-5vURYCq9mwS6GAR_lVymdsjj_x_J0UYizqCzv22cbtorlzp2zm_aQeFhd6IrHWhuVoUhSr9gzcMz-dDJvbJVzJc4JlsoDcRDVB-lvnWtHbtM/s320/missing_repos.png" width="320" /></a></div><br />
I restarted Eclipse and everything seemed back to normal:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTzYjhpCtd16lFtOzI6PrJDWicSniTJOZGWkc3bJUjKm5O3kN0CHb6A5en_cFGb7hxMHLCCrmQuNG9RKnIEsCBEVhpHJ_jshybDpzUjrOk52Koxc8BK-JnYJr8w1242KTjbQcRpyGRZM4/s1600/repo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTzYjhpCtd16lFtOzI6PrJDWicSniTJOZGWkc3bJUjKm5O3kN0CHb6A5en_cFGb7hxMHLCCrmQuNG9RKnIEsCBEVhpHJ_jshybDpzUjrOk52Koxc8BK-JnYJr8w1242KTjbQcRpyGRZM4/s320/repo.png" width="320" /></a></div><br />
Despite its problems, eGit has a good UI. The project is clearly following the <a href="http://wiki.eclipse.org/User_Interface_Guidelines">Eclipse User Interface Guidelines</a>, and I was able to easily transfer my familiarity with Eclipse's CVS and SVN tools to working with git. This is a strong indicator to me that the project is headed in the right direction even if it is not quite there yet. <br />
<br />
<h3>And so...</h3><br />
The basic features that I need exist, but after 20 minutes of using, I hit several obstacles. None of them were insurmountable and the project is usable. Despite this, I do expect that future releases will be significantly more solid. I will likely be using eGit for my day to day work, but for now this will be largely for repository and history exploration, rather than for commit and branch management, which I'll probably use the command line for.<br />
<br />
<br />
<hr /><b>EDIT:</b> I raised <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=339158">Bug 339158</a> and <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=339159">Bug 339159</a> to track some of the problems I found.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com2tag:blogger.com,1999:blog-6917071644715743308.post-33828593126536281862010-10-22T11:12:00.000-07:002010-10-22T11:12:50.983-07:00AJDT 2.1.1 ReleasedI am pleased to announce the release of <a href="http://eclipse.org/ajdt/whatsnew211">AJDT 2.1.1</a>. In this release, we have focussed on <a href="http://eclipse.org/aspectj">AspectJ</a>-aware searching and refactoring. This release also includes AspectJ 1.6.10.<br />
<br />
Please see the <a href="http://www.eclipse.org/ajdt/whatsnew211/">New & Noteworthy</a> for more details, including a list of refactorings that are currently known to work in AspectJ files.<br />
<br />
AJDT 2.1.1 will be available in the upcoming <a href="http://www.springsource.com/developer/sts">SpringSource Tool Suite</a> 2.5.0 release, or you can install it from one of the following update sites:<br />
<br />
Eclipse 3.6: <a href="http://download.eclipse.org/tools/ajdt/36/update">http://download.eclipse.org/tools/ajdt/36/update</a><br />
Eclipse 3.5: <a href="http://download.eclipse.org/tools/ajdt/35/update">http://download.eclipse.org/tools/ajdt/35/update</a>Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-74646407537782567302010-10-07T15:17:00.000-07:002010-10-07T15:17:56.644-07:00More on Groovy-Eclipse and MavenI've had a few requests for the source code for the Groovy-Eclipse integration for maven, as well as a sample project that uses it. You can get both the <a href="http://docs.codehaus.org/download/attachments/182255869/groovy-eclipse-for-maven.zip">sample project and groovy-eclipse compiler plugin for maven</a>. <br />
<br />
They are packaged as two <a href="http://m2eclipse.sonatype.org/">m2eclipse</a> projects, and it is recommended (although not necessary) to import them into Eclipse to use them.<br />
<br />
The <code>groovy-eclipse-compiler</code> project contains the compiler integration. It is a single Java class that calls into the Groovy-enhanced JDT compiler. This maven plugin uses <a href="http://plexus.codehaus.org/">plexus</a> to hook into maven's compiler plugin.<br />
<br />
The <code>groovy-eclipse-maven-tests</code> project is a very simple maven project that has a few Groovy and Java classes that interact with each other. If you want to create your own project using the Groovy-Eclipse maven integration, I would recommend starting with this sample project.<br />
<br />
Please let me know if you have any problems.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com28tag:blogger.com,1999:blog-6917071644715743308.post-81536332419832309252010-09-13T15:50:00.000-07:002010-09-13T15:50:00.632-07:00Better debug support for Groovy-EclipseA short while ago, I wrote about the new <a href="http://contraptionsforprogramming.blogspot.com/2010/08/debuggable-gsps-in-springsource-tool.html">debug support</a> for GSP files inside the SpringSource Tool Suite. What I didn't describe is that this has coincided with enhanced debug support in Groovy-Eclipse.<br />
<br />
There are a few tricks that you can do inside of Eclipse to vastly improve your debugging experience. Much of this is now automatically configured for you when you install the latest snapshot of Groovy-Eclipse, available at this update site: <a href="http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/">http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/</a>.<br />
<br />
<h4>Step filters</h4><br />
The Eclipse Java Development Tools supports the concept of step filters that enable a user to specify regular expressions of type names that should be ignored by the debugger. By this I mean that using any of the <em>step</em> commands (step into, step over, step out of...), the debugger falls through any types that match a filter.<br />
<br />
This is particularly useful for stepping through Groovy MOP stack frames, including most stack frames that start <code>org.codehaus.groovy.*</code>, and many of the <code>sun.reflect.*</code> frames as well.<br />
<br />
Groovy Eclipse now configures a reasonable set of default step-filters for you. These defaults can be viewed and edited in your Eclipse preferences:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiToPvggtMcMrFckge8BzllqE9bHlQvmaYYb_yP8Yx3Yrx3uVAMfPb9W3_pzwLwIH4L1G47I0iGiPyfrVOfqWedZerc_52U_hXzCdtawIVoApJPxDYdkuj_PnrCQq8H8t63FTvfNU7FRt8/s1600/step_filter.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiToPvggtMcMrFckge8BzllqE9bHlQvmaYYb_yP8Yx3Yrx3uVAMfPb9W3_pzwLwIH4L1G47I0iGiPyfrVOfqWedZerc_52U_hXzCdtawIVoApJPxDYdkuj_PnrCQq8H8t63FTvfNU7FRt8/s400/step_filter.png" width="380" /></a></div><br />
Note that it is still possible to stop at a breakpoint set inside of a filtered type, but the next step-* command will step through to the first unfiltered type.<br />
<br />
<h4>Show Logical Structure</h4><br />
At runtime, closure parameters are wrapped in <code>groovy.lang.Reference</code> objects. This makes for a bit of an annoyance when debugging and trying to browse variables. Take for example this simplified, but common debugging situation. You are debugging inside of a closure and you are using the variables view to explore the current value of your closure parameter:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB9iZuMeFk65L2jt_rYTl9XFX2v3YJ3nia2AKlj8RLlQPmQ6ljkBWPya6n5I26t78JETQUXj3jkt-5UFT_ShYUjlOkvMHDiUqdNs3uCnxAE71MAf9CwqmkNC1-_aP3nwnn9qUlxJ9FLUM/s1600/no_logical_structure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB9iZuMeFk65L2jt_rYTl9XFX2v3YJ3nia2AKlj8RLlQPmQ6ljkBWPya6n5I26t78JETQUXj3jkt-5UFT_ShYUjlOkvMHDiUqdNs3uCnxAE71MAf9CwqmkNC1-_aP3nwnn9qUlxJ9FLUM/s400/no_logical_structure.png" width="400" /></a></div><br />
Unfortunately as you can see, you have to dig 3 levels deep to see the contents of the list.<br />
<br />
Again, Eclipse offers a solution. You can select the <em>Show Logical Structure</em> button <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg8OWvSmbpHcQmJ_agpeYVfr00CyhNI0-jbMoLjw_a-ZlLme4jepOT5zghmVIfoaSVUYS0CXsAvUlgKz10wqR88pByjZI_ZYgGhNiaZAvAfqpNGcQ0zPaSxNB8XIUHJyvkhTGcr79KdqA/s320/show_logical_structure_button.png" />. The result is a significantly more concise way to browse your variables:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi47vwT28msIFLJva8O8g-o2dIn8upt8uNchnbl2k_I7jpLNBj6Iq4EiUOBrGrvDCJvGca49N0X3WRyNKY0FFzPhe3APNG7hjsA9EU8t2KLaADri0JawCwaZDyTY26wbhgNwX8HjIqeegE/s1600/logical_structure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="1" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi47vwT28msIFLJva8O8g-o2dIn8upt8uNchnbl2k_I7jpLNBj6Iq4EiUOBrGrvDCJvGca49N0X3WRyNKY0FFzPhe3APNG7hjsA9EU8t2KLaADri0JawCwaZDyTY26wbhgNwX8HjIqeegE/s400/logical_structure.png" width="400" /></a></div><br />
Groovy-Eclipse has added a custom logical structure for <code>Reference</code> objects so that they are automatically dereferenced inside of the variables view. You can edit existing and add new logical structures in your Java Debug preferences:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqxyjs75R9bWHF6fU9xPseC0g3f2IPMn5vop_YtWVW0HhlFBtiXqdjkXzll4tBXUvt-u3ArpmcctruZ_NntccugmAoS9eEkmpUIxF2DFFFAHs6TeNRCyg9MgbE3oqsLfrfJ0wMsT8KlwA/s1600/logical_structure_settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="1" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqxyjs75R9bWHF6fU9xPseC0g3f2IPMn5vop_YtWVW0HhlFBtiXqdjkXzll4tBXUvt-u3ArpmcctruZ_NntccugmAoS9eEkmpUIxF2DFFFAHs6TeNRCyg9MgbE3oqsLfrfJ0wMsT8KlwA/s400/logical_structure_settings.png" width="400" /></a></div><br />
<h4>Stack frame emphasis</h4><br />
Another common complaint about debugging Groovy code is that the extra stack frames from Groovy's MOP hides the application stack frames from view. As an exercise, try to find the application stack frames in the following code (hint: the name of the script is <em>Script.groovy</em>):<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPARUXNaTxC6RGVgfHKYGjWQ53Q7XC7sn_DqXNOonR4-VBRQNxoonbG31aUghdIgGxzTzs2gBYO4qG0L6vLO-rzRi43jGCxah1BZA138BSCdKblAa9VpPnYhjdxYd68h5NAfV2a1UFz30/s1600/stackframes_no_grey.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="1" height="319" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPARUXNaTxC6RGVgfHKYGjWQ53Q7XC7sn_DqXNOonR4-VBRQNxoonbG31aUghdIgGxzTzs2gBYO4qG0L6vLO-rzRi43jGCxah1BZA138BSCdKblAa9VpPnYhjdxYd68h5NAfV2a1UFz30/s320/stackframes_no_grey.png" width="320" /></a></div><br />
On second thought...don't try. Groovy-Eclipse automatically greys-out MOP and related stack frames, making it easy to see application stack frames (without actually hiding Groovy magic):<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikGsD6yu2n7j5wXVCDx6sluHamB4PPz1FsrTGA_FkY0lrt6cWMIbyleBqQ6C6QxfyyP0m-kaYhtCYJQ9z0DwvViz9zQzmNbjlLWe176XWnbxYlJCtvYSMJu2UtsC1tPw_M5sdtureQyo8/s1600/stackframes_grey.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="1" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikGsD6yu2n7j5wXVCDx6sluHamB4PPz1FsrTGA_FkY0lrt6cWMIbyleBqQ6C6QxfyyP0m-kaYhtCYJQ9z0DwvViz9zQzmNbjlLWe176XWnbxYlJCtvYSMJu2UtsC1tPw_M5sdtureQyo8/s320/stackframes_grey.png" width="318" /></a></div><br />
This feature, combined with step filtering above makes stepping through Groovy code significantly more efficient.<br />
<br />
By default, Groovy-Eclipse de-emphasizes some of the most common MOP stack frames, but this can be changed in the Eclipse preferences:<br />
<br />
<div style="border: 2px solid #fff; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl0W3lxMOn854PkDh0hqEydwjH-QQ03BWbW_6uPMNzM7YKy74fX-0eAZcuOpUKmA8ZV48P6jVDXOmmcjoTMVNxXJASE7iOuM1KzV9Giu9mk4QLligVYVnnOEgks_1FK3H49fwRlQ-J5wg/s1600/stackframe_settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="1" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl0W3lxMOn854PkDh0hqEydwjH-QQ03BWbW_6uPMNzM7YKy74fX-0eAZcuOpUKmA8ZV48P6jVDXOmmcjoTMVNxXJASE7iOuM1KzV9Giu9mk4QLligVYVnnOEgks_1FK3H49fwRlQ-J5wg/s400/stackframe_settings.png" width="400" /></a></div><br />
<h4>What's next?</h4><br />
Two of the most requested debugging features are Groovy-aware hotswapping (so that Groovy code can be edited, compiled, and loaded without needing to restart a debugging session) and a Groovy-aware Display view (so that Groovy snippets can be executed in the context of a paused application).<br />
<br />
We've had some <a href="http://andrewclement.blogspot.com/2010/03/groovy-eclipse-groovy-hotswap-support.html">success with hotswapping</a>, but more work needs to be done before it can be generally useful. Specifically, we've hit some limitations due to the class files produced by groovyc and are awaiting a fix for <a href="http://jira.codehaus.org/browse/GROOVY-4152">GROOVY-4152</a>.<br />
<br />
A Groovy-aware display view is something that we need to work on and I hope to have initial support for this for the 2.1.0 release in late October.<br />
<br />
Clearly, we have work to do, but the existing debug support provides significant improvements over what was available even a few months ago.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com0tag:blogger.com,1999:blog-6917071644715743308.post-34236311043866460062010-09-06T21:04:00.000-07:002010-10-08T08:08:52.462-07:00Where are all my stubs?<style type="text/css">
pre {
font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace;
color: #000000;
background-color: #eee;
font-size: 12px;
border: 1px dashed #999999;
line-height: 14px;
padding: 5px;
overflow: auto;
width: 100%
}
</style><br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Update:</b></span> you must also include a <code>pluginRepositories</code> section. See below for XML snippet.<br />
<br />
<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Update:</b></span> See <a href="http://contraptionsforprogramming.blogspot.com/2010/10/more-on-groovy-eclipse-and-maven.html">here</a> for a sample project and the source code of the compiler integration.<br />
<br />
<br />
<br />
<br />
The standard way of compiling joint Groovy-Java code outside of Eclipse has always been through the use of stubs:<br />
<br />
<ol><li>Generate Java stub files for the Groovy files</li>
<li>Compile the Java files using the stubs to compile against</li>
<li>Compile the Groovy files</li>
</ol><br />
Although this works reasonably well in many situations, there are some complications and problems with this approach, most of which have already been described recently in detail on the groovy-dev mailing list <a href="http://groovy.329449.n5.nabble.com/Groovy-s-stub-generator-clearly-broken-tp2267109p2267109.html">here</a> and <a href="http://groovy.329449.n5.nabble.com/Groovy-needs-better-Maven-support-td1842298.html#a1842353">here</a>, so I won't go into them in this post.<br />
<br />
About a year ago, we introduced <a href="http://blog.springsource.com/2009/07/30/a-groovier-eclipse-experience/">Groovy-Eclipse 2.0</a>, which compiles Groovy code by plugging into the JDT compiler and does not need to generate stub files. And as Andy Clement <a href="http://andrewclement.blogspot.com/2010/02/running-groovy-eclipse-joint-compiler.html">describes</a>, it is possible to run the compiler in batch mode on the command line.<br />
<br />
And now, with a little bit of glue code required, I have released a snapshot of the compiler with both ant and maven integration. Although, this is still early work, I do hope that this approach will solve many of the problems that Groovy programmers are having with stub generation. I'll describe below how they both work.<br />
<br />
<h2>Ant integration for Groovy-Eclipse</h2><br />
Ant integration for the batch compiler is fairly simple.<br />
<br />
<ol><li>Download the <a href="http://codehaus.org/~werdna/groovy-eclipse-batch-0.5.0.jar">groovy-eclipse-batch-0.5.0.jar</a> from its temporary location.</li>
<li>Add this jar to your <code>~/.ant/lib</code> directory.</li>
<li>Once you have that, you need to set the <code>build.compiler</code> property to <code>org.codehaus.groovy.eclipse.ant.GroovyCompilerAdapter</code>.</li>
</ol><br />
This will cause ant's <a href="http://www.jajakarta.org/ant/ant-1.6.1/docs/en/manual/CoreTasks/javac.html">javac task</a> to delegate the Groovy-Eclipse compiler for the actual compilation. This means that it is possible to pass any combination of Groovy and Java files to the compiler and most parameters applicable for javac are still available when using the compiler adapter.<br />
<br />
A very simple script that uses the Groovy compiler adapter looks like this:<br />
<br />
<pre><target name="compile">
<property name="build.compiler"
value="org.codehaus.groovy.eclipse.ant.GroovyCompilerAdapter">
<javac srcdir="src" destdir="bin"/>
</target></pre><br />
This script sets compiler adapter and compiles all source files in <code>src</code>, placing the resulting class files in <code>bin</code>. Both <code>*.java</code> files and <code>*.groovy</code> files are included in the compilation.<br />
<br />
<h2>Maven integration for Groovy-Eclipse</h2><br />
Groovy-Eclipse can now also be used from maven. To do so, add the following to your pom.xml.<br />
<br />
The artifacts are currently in the SpringSource snapshot maven repo. You must add it as a regular repository:<br />
<br />
<pre><repositories>
<repository>
<id>springsource</id>
<url>http://maven.springframework.org/snapshot</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories></pre><br />
as well as a plugin repository:<br />
<br />
<pre><pluginRepositories>
<pluginRepository>
<id>springsource</id>
<url>http://maven.springframework.org/snapshot</url>
</pluginRepository>
</pluginRepositories></pre><br />
And in your plugin section, you must change the compiler used by the maven-compiler-plugin. Like the javac ant task, the maven-compiler-plugin does not actually compile, but rather delegates the compilation to a different artifact:<br />
<br />
<pre><build>
...
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
</build></pre><br />
This will allow Groovy files to be compiled. The maven-compiler-plugin prefers all source files to be in <code>src/main/java</code> and <code>src/test/java</code>, but if you prefer you can use the standard Groovy convention and keep your files in <code>src/main/groovy</code> and <code>src/test/groovy</code>. You can do so by adding the following plugin to your build section of the pom:<br />
<br />
<pre><plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
src/main/groovy
src/test/groovy
</sources>
</configuration>
</execution>
</executions>
</plugin></pre><br />
This approach is still in an alpha state and has not been widely tested. It was hard to find reasonably large Groovy-Java projects that use maven for me to try this on. The largest project I have compiled in this way is the <a href="http://gpars.codehaus.org/">GPars project</a> (GPars uses gradle for its build, but I adapted its build.gradle to a pom.xml and successfully ran maven on it). This project includes 168 Java and Groovy files in main as well as 338 Groovy files in test. In a not particularly scientific manner, I did a few runs of building the main and test classes using both Groovy-Eclipse and GMaven and the results are that Groovy-Eclipse is reasonably faster than GMaven for this project:<br />
<br />
<ul><li> Time to compile main and test classes using GMaven: 36s</li>
<li> Time to compile main and test classes using Groovy-Eclipse: 28s</li>
</ul><br />
In addition to being largely untested in the wild, there are a few caveats when using Groovy-Eclipse:<br />
<br />
<ul><li> Since stubs are not generated, GroovyDoc and any other artifacts that rely on stubs cannot be generated.</li>
<li>This only supports Groovy 1.7.</li>
<li>Third (ant only), your project must have at least one Java file in it (this can be an empty stub), or else ant will finish without compiling anything. There is a patch for this (<a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=48829">Bug 48829</a>), but I am waiting for it to be contributed back to ant.</li>
<li>Fourth (maven only), your maven project must have at least one groovy file or else compilation will not occur. (Though, if your project <em>doesn't</em> have any Groovy files, then why are you using a Groovy compiler?)</li>
</ul><br />
There is still some work to be done, but it is ready enough for people to start trying it out. Feedback is greatly appreciated. You can reply to this blog post, send a message to the <a href="http://xircles.codehaus.org/lists/eclipse-plugin-user@groovy.codehaus.org">mailing list</a>, or <a href="http://jira.codehaus.org/browse/GRECLIPSE">raise an issue on jira</a>.Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com19tag:blogger.com,1999:blog-6917071644715743308.post-59101776328612701182010-08-24T12:24:00.000-07:002010-08-30T10:48:43.807-07:00Debuggable GSPs in SpringSource Tool Suite<div class="separator" style="clear: both; text-align: center;"></div><br />
A basic trick of Groovy Server Page debugging that seasoned Grails developers know is that by adding <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">?showSource=true</span> to a URL for any of your GSPs you can view the Groovy translation of your GSP code. For example, the vanilla create GSP (<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">http://localhost:8080/TripPlanner/trip/create.gsp</span>) gets rendered like this in the browser:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcAEyw6OgcSjFAd6lPKH8lJqjN8tsMUZicue-v1x1wB5tSpSmaDZLTK3M57ho6arA8QbZry47JhWCQK43Q0sGIZThfoMoV5rpWv-GRZ81NbACBj6BUzCaxrIXsty92dNerShNlj31imJ0/s1600/create-browser.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcAEyw6OgcSjFAd6lPKH8lJqjN8tsMUZicue-v1x1wB5tSpSmaDZLTK3M57ho6arA8QbZry47JhWCQK43Q0sGIZThfoMoV5rpWv-GRZ81NbACBj6BUzCaxrIXsty92dNerShNlj31imJ0/s200/create-browser.png" width="176" /></a></div><br />
And altering the URL to this: <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">http://localhost:8080/TripPlanner/trip/create.gsp?showSource=true</span>, you can see the translated source:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtrc-pHzrxTChCgvslog3X_2SzUmLUybZ855W1LWVvqw9rW8BaZ6zL1P_nL5mVR_JjV9C-l8VLmnLDV9G9kkU47MBQ-sX1U1DEQjJwECfGjrzer1BJrVfxYwU_c0gSEHA3sRM88dU4h0s/s1600/create-showSource.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtrc-pHzrxTChCgvslog3X_2SzUmLUybZ855W1LWVvqw9rW8BaZ6zL1P_nL5mVR_JjV9C-l8VLmnLDV9G9kkU47MBQ-sX1U1DEQjJwECfGjrzer1BJrVfxYwU_c0gSEHA3sRM88dU4h0s/s320/create-showSource.png" /></a></div><br />
There is a mapping between lines of code of the original GSP and the lines of code of the Groovy translation. In fact, if you are using Grails 1.3.4 or above, and scroll to the bottom of the translation, you will see something like this:<br />
<br />
<br />
<pre> 82: @org.codehaus.groovy.grails.web.transform.LineNumber(
83: <span class="Apple-tab-span" style="white-space: pre;"> </span>lines = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 11, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 17, 17, 18, 18, 19, 19, 20, 21, 23, 23, 23, 23, 25, 25, 26, 35, 35, 35, 35, 37, 37, 37, 39, 39, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
84: <span class="Apple-tab-span" style="white-space: pre;"> </span>sourceName = "create.gsp"
85: )
86: class ___LineNumberPlaceholder { }</pre><br />
<br />
This is the line mapping information and each element of the <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">lines</span> array maps a line from the translation (the array index) to a line in the original source code (the value at that index). This is not particularly useful to humans, but it is to the SpringSource Tool Suite.<br />
<br />
Using this information, STS is finally able to provide some debugging support for GSP files. You can set a breakpoint at a line in your GSP editor, and the debugger will pause at that line when it is reached while rendering the page:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP7UoeJNmA8ABB_l2FUYru5yGPjPcW2kpWuFPX7FjvqpdbP_yF8OIBVlQpfgkYzSjoe9oBcv-gxDJl6ACfzxAFFoop0CacwR7G9X-yJcJoldHkXdEoAn4RAt-0E4YLA6AwCa4C1c0kk80/s1600/create-debug.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP7UoeJNmA8ABB_l2FUYru5yGPjPcW2kpWuFPX7FjvqpdbP_yF8OIBVlQpfgkYzSjoe9oBcv-gxDJl6ACfzxAFFoop0CacwR7G9X-yJcJoldHkXdEoAn4RAt-0E4YLA6AwCa4C1c0kk80/s400/create-debug.png" width="400" /></a></div><br />
<br />
At this point, your GSP can be interacted with like any Groovy file. For example, you can inspect the current state of variables in your page binding:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD_5U1q45W_dYS0Cb2C4UlNGPwRuS_zUeKi56qEMM7w0zU8jY5dU8zVQgGFGKvx0e1BwjPTbQmoPiSnSrUTbquX6Xk0pGuWDbphB8HWVVxh_qfnhO9R7XO0G25q44HdD04JUZzS8p_3SU/s1600/variables-pane.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD_5U1q45W_dYS0Cb2C4UlNGPwRuS_zUeKi56qEMM7w0zU8jY5dU8zVQgGFGKvx0e1BwjPTbQmoPiSnSrUTbquX6Xk0pGuWDbphB8HWVVxh_qfnhO9R7XO0G25q44HdD04JUZzS8p_3SU/s640/variables-pane.png" width="640" /></a></div><br />
<br />
And you can execute values in the display view (using Java syntax only for now):<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAY1qP_s6uyYstt26WMSaQYQDFxDTgAaG1UFqUFtqORi_7KVAlyutmBSQ-RO-BQFOSVOjbdy_T7-0gJ6ELhQcTSJnkK0WRZ7pvzWrpPNg3PIBRg2kx3IrHlSyWpFceT_rLSc5EuyaRr_k/s1600/display-pane.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="60" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAY1qP_s6uyYstt26WMSaQYQDFxDTgAaG1UFqUFtqORi_7KVAlyutmBSQ-RO-BQFOSVOjbdy_T7-0gJ6ELhQcTSJnkK0WRZ7pvzWrpPNg3PIBRg2kx3IrHlSyWpFceT_rLSc5EuyaRr_k/s640/display-pane.png" width="640" /></a></div><br />
<br />
This feature has been fun to implement since it was my first foray into Eclipse's Java debug interface, but I am not sure how useful it is going to be. Lines in a GSP are not executed sequentially. Rather, many are executed out of order through closures inside of an <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">invokeTag</span> method call. Also, I have not completely worked out how to determine if a breakpoint is at a valid location if Grails is not already running. So, at this point it is possible to set a breakpoint on any blank line, but these breakpoints are only valid if they are set on a line containing a GSP tag or some other kinds of things.<br />
<br />
But, I do hope this is useful to you and if you are interested in trying this new feature out, then you can <a href="http://www.springsource.com/developer/sts">download STS 2.5.0M3</a> and install the latest version of Grails tool support. Enjoy!<br />
<div><br />
</div>Andrew Eisenberghttp://www.blogger.com/profile/07897697507691706588noreply@blogger.com5