<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4884093826755448868</id><updated>2011-12-29T11:45:40.364+01:00</updated><category term='Code'/><category term='Xtext'/><category term='3D'/><category term='MDD'/><category term='Eclipse'/><category term='EMF'/><category term='Mac OS X'/><category term='transformation'/><category term='Logging'/><category term='Xtend'/><category term='UML'/><category term='Events'/><category term='Java'/><category term='OCL'/><category term='GEF3D'/><category term='e4'/><category term='CIB'/><title type='text'>Jevopi's Developer Blog</title><subtitle type='html'>If the meaning of the blog isn't clear, there really should be more of a description here...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-8357004375641558902</id><published>2011-12-22T15:47:00.001+01:00</published><updated>2011-12-22T15:48:37.222+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><category scheme='http://www.blogger.com/atom/ns#' term='CIB'/><title type='text'>GEF3D goes Git, Maven/Tycho, and Hudson</title><content type='html'>or&lt;br /&gt;
&lt;b&gt;Standing on the shoulders of giants&lt;/b&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-P88r4sPPwoY/TvNCoaYOeOI/AAAAAAAAAJU/4w7zN3AplpU/s1600/GEF3D+nightly.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-P88r4sPPwoY/TvNCoaYOeOI/AAAAAAAAAJU/4w7zN3AplpU/s1600/GEF3D+nightly.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;i&gt;Abstract: Setting up a continuous integration build based on Git, Maven/Tycho, and Hudson is surprisingly easy. I assume that this is no real news for most readers. However, I ways very skeptical about that, especially because of all the project dependencies. So, this posting is meant for readers hesitating to set up an automatic build system because they think that it would be too complicated, just as I thought until .. well, until now.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
One of the things on my todo list of 2011 was to set up a continuous integration build for &lt;a href="http://eclipse.org/gef3d"&gt;GEF3D&lt;/a&gt;. I did set up such a system several years ago, using some XML files describing a module and its dependencies, and an &lt;a href="http://www.w3.org/TR/1999/REC-xslt-19991116"&gt;XSL Transformation&lt;/a&gt; generating &lt;a href="http://ant.apache.org/"&gt;Ant&lt;/a&gt; scripts based on these module descriptions. In order to run nightly builds, &lt;a href="http://linux.die.net/man/8/cron"&gt;cron&lt;/a&gt; was used -- yeah, good old times. I remember trying &lt;a href="http://maven.apache.org/"&gt;Maven&lt;/a&gt; back then, and I was so much disappointed that I wrote my own tools. Due to this experience, I had lots of respect setting up a build system for &lt;a href="http://eclipse.org/gef3d"&gt;GEF3D&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
In the beginning, &lt;a href="http://milesparker.blogspot.com/"&gt;Miles&lt;/a&gt; helped me to set up a &lt;a href="http://eclipse.org/buckminster/"&gt;Buckminster&lt;/a&gt; based build. He had some experience with this tool because &lt;a href="https://hudson.eclipse.org/hudson/job/amp-nightly/"&gt;his build system&lt;/a&gt; for the &lt;a href="http://eclipse.org/amp/"&gt;AMP&lt;/a&gt; project is based on Buckminster as well. Since Miles has switched to &lt;a href="http://git-scm.com/"&gt;Git&lt;/a&gt;, he suggested the GEF3D project to switch as well. This would simplify the set up, as we only have to deal with one version control system. I filed a &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=359798"&gt;bug report&lt;/a&gt; for moving GEF3D from SVN to Git. Since I had read in the &lt;a href="http://wiki.eclipse.org/Git/Migrating_to_Git"&gt;Git Migration guide&lt;/a&gt; that when moving to Git it would also be a good opportunity to refactor the structure of the project, we decided to introduce folders separating plugins, features, examples, and so on. Somehow my report got forgotten... As it was very complicated to configure the Buckminster build, and due to &lt;a href="http://www.fernuni-hagen.de/ps/prjs/refacola/"&gt;other things&lt;/a&gt;, I also didn't push it.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Migrate to Git&lt;/h3&gt;So, as the year is reaching its end, I decided to give it another try -- despite all these unknown tools such as Buckminster, Git, and Hudson. I started with Git. The first giants I have to give kudos to are the &lt;a href="https://dev.eclipse.org/mailman/listinfo/git"&gt;Eclipse Git guys&lt;/a&gt;, and &lt;a href="http://www.winklerweb.net/index.php"&gt;Stefan&lt;/a&gt;, who wrote a nice blog posting about how he &lt;a href="http://www.winklerweb.net/index.php/blog/4-eclipse/16-migrating-the-cdo-svn-repository-to-git"&gt;moved CDO to Git&lt;/a&gt;. The basic idea of Stefan's approach is really simple: &lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Create a Git repository locally and use svn2git to migrate the code. Note that there exist different svn2git tools. I used &lt;a href="https://github.com/nirvdrum/svn2git"&gt;https://github.com/nirvdrum/svn2git&lt;/a&gt;, while Stefan used &lt;a href="https://github.com/schwern/svn2git.git"&gt;https://github.com/schwern/svn2git.git&lt;/a&gt;! The import is a single command, in my case&lt;br /&gt;
&lt;pre&gt;svn2git https://dev.eclipse.org/svnroot/technology/org.eclipse.gef3d --authors users.txt&lt;/pre&gt;&lt;code&gt;users.txt&lt;/code&gt; is a list of the committers, with &lt;code&gt;username = prename surname &amp;lt;email&amp;gt;&lt;/code&gt;. Very simple, indeed. Since GEF3D is not that big, the migration requires only 10 minutes, and the created Git repository has a size about 9 MB.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Then I refactored the project structure, simply done via command line: &lt;code&gt;git mv&lt;/code&gt; is your friend here. (&lt;a href="http://twitter.com/kristianduske"&gt;Kristian&lt;/a&gt; helped me with little problems, as I'm a Git rookie as well ;-) ).&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Commit all changes to the local Git repository, pack the ".git" repository, upload it to developer.eclipse.org and let the webmaster unpack it at &lt;a href="http://git.eclipse.org/c/"&gt;git.eclipse.org&lt;/a&gt;.&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;Stefan had to do much more work, as he had to create four repositories by extracting things from the existing &lt;a href="http://eclipse.org/cdo/"&gt;CDO project&lt;/a&gt;, which is much bigger than the GEF3D project, of course.  You will find the GEF3D git repository at &lt;a href="http://git.eclipse.org/c/gef3d/org.eclipse.gef3d.git"&gt;git://git.eclipse.org/gitroot/gef3d/org.eclipse.gef3d.git&lt;/a&gt;  &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Maven/Tycho&lt;/h3&gt;During my research about some Git questions, I stumbled over the &lt;a href="http://www.eclipse.org/modeling/gmp/?project=gmf-tooling"&gt;GMF tooling&lt;/a&gt; project (well, I know that project for a long time, but I didn't cared about the "internal" structure). It uses the same &lt;a href="http://git.eclipse.org/c/gmf-tooling/org.eclipse.gmf-tooling.git/tree/"&gt;project structure&lt;/a&gt; as the GEF3D team had decided to be used for GEF3D, and it uses &lt;a href="http://www.eclipse.org/tycho/"&gt;Tycho&lt;/a&gt;. Although I had my (bad) experiences with Maven, I gave Tycho a try. And again, I was very much surprised at how easy it is to set up a complete build system with Maven/Tycho. I used the GMF tooling poms as a template, and after a couple of minutes (not hours!) I had a build system which could build most parts of GEF3D. Kudos to the Tycho giant &lt;a href="http://eclipse.org/tycho/getting_involved.php"&gt;team&lt;/a&gt;!   Besides some special Eclipse packaging things, e.g., telling Maven how to handle an Eclipse plugin (and probably much more hidden under the hud), one really nice feature is the ability to use &lt;a href="http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/tasks/pde_p2_builds.htm"&gt;P2 repositories&lt;/a&gt; as &lt;a href="http://maven.apache.org/guides/introduction/introduction-to-repositories.html"&gt;Maven repositories&lt;/a&gt;. GEF3D has dependencies to GEF, GMF and EMF. To resolve these dependencies, I only had to define a single repository:  &lt;br /&gt;
&lt;pre&gt;&amp;lt;repository&amp;gt;
    &amp;lt;id&amp;gt;Galileo&amp;lt;/id&amp;gt;
    &amp;lt;layout&amp;gt;p2&amp;lt;/layout&amp;gt;
    &amp;lt;url&amp;gt;http://download.eclipse.org/releases/galileo&amp;lt;/url&amp;gt;
&amp;lt;/repository&amp;gt;  
&lt;/pre&gt;This is so cool! &lt;br /&gt;
Unfortunately, &lt;a href="http://lwjgl.rg/"&gt;LWJGL&lt;/a&gt; (the OpenGL wrapper library used by GEF3D) does not provide a p2 repository, but an old style update site instead. That is, its update site provides only the &lt;code&gt;site.xml&lt;/code&gt; file, and no p2 metadata. By accident, I'm the guy maintaining the LWJGL update site build script. It is an Ant based build, added to the overall LWJGL build system. Since LWJGL does not use Maven, and no Eclipse at all, I could not rely on the Tycho or &lt;a href="http://wiki.eclipse.org/Equinox/p2/Publisher"&gt;p2 publisher&lt;/a&gt; to build the p2 metadata. In order to keep the overhead for the LWJGL project low, I wrote my own Ant task creating the missing p2 metadata for an old style update site. If you ever need something like this, the code of this Ant task is available from the &lt;a href="https://java-game-lib.svn.sourceforge.net/svnroot/java-game-lib/trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/StandalonePublisher.java"&gt;LWJGL SVN&lt;/a&gt; -- it is a plain Java Ant task without any Eclipse dependencies. It can also be used standalone in order to create the content.xml/jar and artifact.xml/jar from a bunch of plugins, features, and a site.xml. At the moment, the official &lt;a href="http://lwjgl.org/update"&gt;LWJGL update site&lt;/a&gt; is not updated yet and I'm using a personal mirror for GEF3D. But &lt;a href="http://matzon.users.sourceforge.net/"&gt;Brian&lt;/a&gt;, who maintaines the LWJGL update site, will probably update it soon.   &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Remark:&lt;/i&gt; The LWJGL update site provides the &lt;a href="http://marketplace.eclipse.org/content/lwjgl-plugin"&gt;LWJGL plugin&lt;/a&gt;, which basically bundles LWJGL as an Eclipse plugin. Additionally, source and documentation bundles are provided, and a tool bundle with an information view (showing the OpenGL settings of your graphics card), and a library for easily configuring standalone LWJGL apps.  And thank you very much, Brian, for maintaining the update site at lwjgl.org!  &lt;br /&gt;
&lt;br /&gt;
I also had to fight with Maven and Tycho to get the source and documentation bundles build (seems as if some tiny things were changed when Tycho moved to Eclipse, so you have to compare the settings in the documentation with actual poms). Thanks to &lt;a href="http://aniszczyk.org/2011/03/04/maven-tycho-hudson-jenkins-and-eclipse/"&gt;Chris' Minerva&lt;/a&gt; project, and the GMF tooling project, I could solve these issues. The &lt;a href="http://www.blogger.com/%3Ca%20href=" http:="" minerva"="" wiki.eclipse.org=""&gt;Minerva&lt;/a&gt; project also demonstrates how to configure tests (simple JUnit tests, and plugin tests with SWT bot) -- and it was easy to configure this for GEF3D as well.  Although I'm still curious about &lt;a href="http://eclipse.org/buckminster/"&gt;Buckminster&lt;/a&gt;, I was really surprised how well Maven/Tycho works. And since it is already working, I won't switch to Buckminster. However, I could imagine that if you have special requirements, it would be easier to configure that with Buckminster. I'm currently tutoring a student setting up a Buckminster build system for a research project -- I'm looking forward to comparing the results.  &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Hudson&lt;/h3&gt;Eventually, I had to set up a &lt;a href="http://eclipse.org/hudson/"&gt;Hudson&lt;/a&gt; job for the GEF3D build. Miles had already prepared that &lt;a href="https://hudson.eclipse.org/hudson/job/gef3d-nightly/"&gt;job&lt;/a&gt;, and I only had to configure GEF3D's git repository, and Maven. I tried this first on a locally installed Hudson ("installed" sounds like a lot of work, actually it is only downloading a war and start Hudson via java -jar hudson.war). Again, setting up a Hudson job for a Maven based build system is really easy. All you have to do is to specify your code repository (git in my case), and the parameters passed to Maven (which usually is "clean install"). That's it.   Well, at the moment I have some problems building the javadoc API reference, as the Javadoc at hudson.eclipse.org apparently behaves a little bit different as the Javadoc on my local machine. But at the moment I can ignore that problem, and I'm sure this can be solved soon.  &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Summary&lt;/h3&gt;I was really surprised at how easy it was to migrate from SVN to Git, to set up a build system with Maven/Tycho, and to configure the job with Hudson. As a matter of fact it was that easy, that I probably will use Git, Maven/Tycho, and Hudson for new projects right from the start (I know, that's what all the agile guys tell you to do... but I didn't dare to actually do it). I was particularly surprised at how good Maven works with Eclipse thanks to Tycho -- the Tycho team did a really great job here!  According to &lt;a href="http://www.leonardcohen.com/"&gt;Leonard&lt;/a&gt;, there's a crack in everyting... and I'm a little bit nervous about configuring special requirements with Maven, such as integrating code transformation tools. I've found some blog posts about &lt;a href="http://kthoms.wordpress.com/2011/12/08/xtext-2-2-finally-brings-maven-support-for-xtend/"&gt;getting Xtext/Xtend&lt;/a&gt; work with Maven -- seems as if there are reasons to being nervous... but that's how the light comes in :-D&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-8357004375641558902?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/8357004375641558902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=8357004375641558902' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/8357004375641558902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/8357004375641558902'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/12/gef3d-goes-git-maventycho-and-hudson.html' title='GEF3D goes Git, Maven/Tycho, and Hudson'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-P88r4sPPwoY/TvNCoaYOeOI/AAAAAAAAAJU/4w7zN3AplpU/s72-c/GEF3D+nightly.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-7518513452467255473</id><published>2011-08-21T23:43:00.004+02:00</published><updated>2011-11-01T15:29:27.940+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='UML'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>Java To OmniGraffle</title><content type='html'>If you ask developers using Mac OS X about their favorite diagramming tool, you  will often get the same answer: &lt;a href="http://www.omnigroup.com/products/omnigraffle/"&gt;OmniGraffle&lt;/a&gt;. I also like OmniGraffle very much, and I'm still wondering what makes this tool so much better then all the &lt;a href="http://www.eclipse.org/gef"&gt;GEF&lt;/a&gt; based editors.&lt;br /&gt;
&lt;br /&gt;
When I have to create diagrams for documenting some Java code, I used to manually draw an UML like class diagram with OmniGraffle. This is an error prone process, and a boring one as well. So, I tried to find a better solution. Since I didn't find any existing tool, I wrote a small Eclipse plugin my self. It automatically generates OmniGraffle class diagrams from existing Java code.&lt;br /&gt;
&lt;br /&gt;
Its usage is very simple: Open or create a drawing in OmniGraffle. Then switch back to Eclipse and select "Create OmniGraffle Diagram" from the context menu of a package in the package explorer, as shown in Figure 1. Configure the output, as shown in Figure 2. The plugin will scan the package and add a class diagram of this package to the front most drawing opened with OmniGraffle. Figure 3 shows the result created by the plugin without any manual changes. It is a visualization of the package "ReverseLookup" of &lt;a href="http://www.eclipse.org/gef3d"&gt;GEF3D&lt;/a&gt;.&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: left;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-owvGtVjfxbs/TlF1c6mMKGI/AAAAAAAAAHc/o2ZkGLUDX60/s1600/CreateOmniGraffleDiagram.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="156" src="http://3.bp.blogspot.com/-owvGtVjfxbs/TlF1c6mMKGI/AAAAAAAAAHc/o2ZkGLUDX60/s200/CreateOmniGraffleDiagram.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig. 1: Context menu entry&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-mPjvwjAskPg/TlF2-z-w6HI/AAAAAAAAAHk/1IhrjymQhUc/s1600/JavaToOmniGraffleConfigDlg.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="200" src="http://3.bp.blogspot.com/-mPjvwjAskPg/TlF2-z-w6HI/AAAAAAAAAHk/1IhrjymQhUc/s200/JavaToOmniGraffleConfigDlg.png" width="156" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig. 2: Configuration Dialog&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt; &lt;td&gt;&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-6c0ftSVewuo/TlF3GDSBUlI/AAAAAAAAAHs/l2_fL91rS8I/s1600/sampleReverseloookup.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="154" src="http://1.bp.blogspot.com/-6c0ftSVewuo/TlF3GDSBUlI/AAAAAAAAAHs/l2_fL91rS8I/s200/sampleReverseloookup.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Fig 3: Created class diagram&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div&gt;&lt;strike&gt;At this moment, the plugin can only create class diagrams for a single package.&lt;/strike&gt; &lt;i&gt;&lt;b&gt;Update:&lt;/b&gt; The plugin can create class diagrams for selected types, packages, and sub packages. Besides, the context of selected classes, that is types on which the selected types depend on, can be visualized as well.&lt;/i&gt; Attributes are drawn as associations if possible, parameterized collection types are recognized and replaced by 0..* associations. You can configure the output with some switches. Besides filtering members based in their scope, I have added some "filters" I often use when I draw diagrams manually:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Getter and setters can be omitted&lt;/li&gt;
&lt;li&gt;Methods implementing or overriding methods of interfaces or classes already shown in the diagram can be omitted as well&lt;/li&gt;
&lt;li&gt;In order to better see relations between classes, you can force to draw all associations, even if they would be filtered out by the scope filter.&lt;/li&gt;
&lt;/ul&gt;The newly created shapes are initially drawn using OmniGraffle's hierarchical layout algorithm.&lt;br /&gt;
&lt;br /&gt;
Tip: In order to manually change the diagram, you may want to have a look at my &lt;a href="http://graffletopia.com/stencils/447"&gt;collection of UML&lt;/a&gt; shapes at &lt;a href="http://graffletopia.com/"&gt;Graffletopia&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
You can install the plugin via the update site:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;http://jevopi.de/updatesite/de.jevopi.JavaToOmniGraffle&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;This is an&amp;nbsp;&lt;strike&gt;beta&amp;nbsp;&lt;/strike&gt;alpha version, which will expire 2012. If you find this plugin useful, flattr me! Or leave me a comment below. Depending on the feedback, I will continue developing the plugin -- or not ;-)&lt;br /&gt;
&lt;br /&gt;
In the preferences, you can set the default configuration settings and define the name of your OmniGraffle installation (however, the plugin tries to find the latest installed version automatically).&lt;br /&gt;
&lt;br /&gt;
Last but not least: Of course, this plug is only available on Mac OS X, since OmniGraffle is a native Mac application. The communication between Eclipse and OmniGraffle is done via AppleScript, which is very easy thanks to &lt;a href="http://www.peterfriese.de/running-applescript-from-java/"&gt;Peter Friese's blog post&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;(At&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;a href="http://stackoverflow.com/questions/3483370/from-java-code-in-eclipse-to-uml-class-diagrams-in-omnigraffle"&gt;Stackoverflow&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;, someone estimated a tool for creating OmniGraffle diagrams from Eclipse UML2 based models would require 18 months development effort. Well, I needed less then 18 hours. But I only convert Java packages to class diagrams... ;-) ).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Update 2011-11-01:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Besides packages, selected types and sub packages can be visualized.&lt;/li&gt;
&lt;li&gt;The context of visualized types can be visualized. That is, types on which the selected types depend on, such as super classes, can be rendered additionally to the selected classes. These context types are rendered in gray.&lt;/li&gt;
&lt;li&gt;The default package is now handled as well (see comment by mathpup).&lt;/li&gt;
&lt;/ol&gt;&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-7518513452467255473?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/7518513452467255473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=7518513452467255473' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7518513452467255473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7518513452467255473'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/08/java-to-omnigraffle.html' title='Java To OmniGraffle'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-owvGtVjfxbs/TlF1c6mMKGI/AAAAAAAAAHc/o2ZkGLUDX60/s72-c/CreateOmniGraffleDiagram.png' height='72' width='72'/><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-7281198850129296974</id><published>2011-06-29T00:17:00.001+02:00</published><updated>2011-06-29T09:20:00.795+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>It's full of classes!</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.youtube.com/watch?v=7EiFITlSJv4" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="111" src="http://2.bp.blogspot.com/-ZTuZcZBFUVg/TgrReMkgAAI/AAAAAAAAAHE/LHHM1iZDN7c/s200/FoC.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;cite&gt;"The thing's hollow---it goes on forever---and---oh my God!---it's full of stars!" (Arthur C. Clarke: 2001. A Space Odyssey)&lt;/cite&gt;&lt;br /&gt;
&lt;br /&gt;
When I presented &lt;a href="https://eclipse.org/gef3d"&gt;GEF3D&lt;/a&gt; in the past, people often ask me if it will scale, that is if a large number of items could be displayed. Well, the &lt;a href="http://www.youtube.com/watch?v=7EiFITlSJv4"&gt;following screencast&lt;/a&gt;, inspired by Kubrick's great movie, shows a flight through the JDK. That is, every package of the 1.000 packages contained in the JDK is visualized as a plane in 3D space. On that plane, the classes are displayed---in total, more than 20.000 classes and interfaces are shown that way. Since the whole demo is a more or less a performance test, the classes are not really layouted yet. Also, only intra-package generalizations and implementations are shown yet.&lt;br /&gt;
&lt;br /&gt;
&lt;iframe width="560" height="349" src="http://www.youtube.com/embed/7EiFITlSJv4" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
The flight is sometimes a little bit bumpy. However, flying through 20.000 elements is more or less the worse case. Usually, the camera is moved in a specific area, and only sometimes a tracking shot may be used to "fly" to the next interesting area. As you will notice at the very beginning of the video, the camera is moving quite smoothly. Well, there is still room for improvement ;-) &lt;br /&gt;
&lt;br /&gt;
Note that the video does not only demonstrate the overall performance of GEF3D, but also some of its features:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;the whole flight through the package tube is a single GEF3D tracking shot&lt;/li&gt;
&lt;li&gt;note the high quality font rendering&lt;/li&gt;
&lt;li&gt;level-of-detail (LOD) techniques are implemented in two ways:&lt;ul&gt;&lt;li&gt;fonts are either rendered as texture or vector font, depending on the distance of the text to the camera&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;packages are painted empty, with only the name of the package, or with their content, depending on the distance to the camera. This kind of LOD technique is not part of GEF3D yet, but it can easily be added.&lt;/li&gt;

&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;actually, you see 1.000 GEF editors, combined into a single 3D multi editor&lt;/li&gt;


&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-7281198850129296974?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/7281198850129296974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=7281198850129296974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7281198850129296974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7281198850129296974'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/06/its-full-of-classes.html' title='It&apos;s full of classes!'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-ZTuZcZBFUVg/TgrReMkgAAI/AAAAAAAAAHE/LHHM1iZDN7c/s72-c/FoC.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-6692708026891207188</id><published>2011-06-09T14:50:00.001+02:00</published><updated>2011-06-09T14:51:38.111+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Xtext'/><title type='text'>When your MWE2 workflow is not working...</title><content type='html'>MWE2 is a kind of Ant for model related tasks. Xtext is using MWE2, and I also use it to run my own Xpand generator templates. It's a nice tiny tool, and one of the nice things is that it runs in its own JVM, so you can easily extend MWE2 with new components which resides in your project. When MWE2 is started, the project settings, i.e. the classpath (including all information from the plugin dependencies), are passed to the workflow. Unfortunately, this may produce problems which are really hard to find, mostly because the error message do not really tell you where to find the actual problem. Here is a list of some problems I have run into several times (using Eclipse 3.6 and Xtext/Xpand 1.0.1). Note that all the problems mentioned and fixed below may be caused by other reasons, requiring other fixes.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Problems instantiating module&lt;/h3&gt;&lt;dl&gt;&lt;dt&gt;Error message:&lt;/dt&gt;
&lt;dd&gt;Error message in console: &lt;pre class="shadowbox"&gt;1    [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems instantiating module ...
...
Caused by: org.eclipse.emf.mwe.core.ConfigurationException: The platformUri location '......' does not exist 
&lt;/pre&gt;&lt;/dd&gt;
&lt;dt&gt;Possible fix:&lt;/dt&gt;
&lt;dd&gt;Fix projectName in MWE2 file.&lt;/dd&gt; &lt;/dl&gt;I run into this problem after renaming a project. Ensure the project name defined in your MWE2 file &lt;br /&gt;
&lt;pre&gt;var projectName = ".."
&lt;/pre&gt;matches the actual project name. This line is present in Xtext related MWE2 files.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Couldn't find module with name&lt;/h3&gt;&lt;dl&gt;&lt;dt&gt;Error message:&lt;/dt&gt;
&lt;dd&gt;Error message in console: &lt;pre class="shadowbox"&gt;ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Couldn't find module with name ...
&lt;/pre&gt;&lt;/dd&gt;
&lt;dt&gt;Possible fix:&lt;/dt&gt;
&lt;dd&gt;Create missing src-gen folder.&lt;/dd&gt; &lt;/dl&gt;I run into this problem after checking out a project from a code repository. Since we do not add generated code to the repository, the src-gen folder was not added to the repository. Hence, it was not present after having checked out the project. However, it is configured in the build.properties. This seems to lead to a problem when the classpath is computed, so that the src folder is not added to the classpath either. Since the MWE2 file resides in the src folder, is is not found and, consequently, the module is not found. I was able to fix this problem by simply creating the src-gen folder. In order to not cause this problem again, I have added the src-gen folder to the repository and ignore only its content.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Workflow definition is ignored&lt;/h3&gt;&lt;dl&gt;&lt;dt&gt;Error message:&lt;/dt&gt;
&lt;dd&gt; None. However, the selected workflow is completely ignored. It seems as if another workflow is executed. &lt;/dd&gt;
&lt;dt&gt;Possible fix:&lt;/dt&gt;
&lt;dd&gt;Ensure module name of workflow, that is the first line in MWE2 file &lt;pre&gt;module ..
&lt;/pre&gt;is unique.&lt;/dd&gt; &lt;/dl&gt;This seems to be a typical copy- and paste error. Actually, in deed another workflow is executed. Although one can run an MWE2 file via "Run as../MWE2 workflow", the launcher does not directly call the actual workflow file. Instead, the name of the module is read and then the internal representation of this module is been executed. If you define two of more workflows with the same module name, only one of these modules is actually present (there seems to be some kind of map from module name to module).&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Couldn't resolve reference to JvmType 'Workflow'.&lt;/h3&gt;&lt;dl&gt;&lt;dt&gt;Error message:&lt;/dt&gt;
&lt;dd&gt;Error in MWE2 workflow file: &lt;pre&gt;Couldn't resolve reference to JvmType 'Workflow'.&lt;/pre&gt;When you try to run the workflow, the following message appears: &lt;pre&gt;Please put bundle 'org.eclipse.mwe2.launch' on your project's classpath.
&lt;/pre&gt;&lt;/dd&gt;
&lt;dt&gt;Possible fix:&lt;/dt&gt;
&lt;dd&gt;Ensure Plug-in Dependencies are correctly added to classpath. &lt;/dd&gt; &lt;/dl&gt;This error can be caused by at least one of the following problems:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;your project is not an OSGi/Plug-in project. This can be fixed by converting the (Java) project to a Plug-in project.&lt;/li&gt;
&lt;li&gt;as printed in the dialog, ensure 'org.eclipse.mwe2.launch' to be listed in the plug-in dependencies&lt;/li&gt;
&lt;/ul&gt;While these are obvious reasons for the error, in my case I had configured the project as plug-in project and 'org.eclipse.mwe2.launch' was defined in the dependency list. However, it still didn't worked. This may be caused because I renamed the project, and probably something had gone wrong. I noticed the problem only because the Package Explorer didn't showed the entry "Plug-In Dependencies". I assume there may be some corrupt cache entries. I only was able to fix this problem by creating a new plug-in project and moving the content of the broken project into the new one.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Weird errors when generating the parser etc.&lt;/h3&gt;&lt;dl&gt;&lt;dt&gt;Error message:&lt;/dt&gt;
&lt;dd&gt;When running the Xtext MWE2 workflow to generate the code from your grammar, weird errors occur indicating problems in your grammar. &lt;/dd&gt;
&lt;dt&gt;Possible fix:&lt;/dt&gt;
&lt;dd&gt;Increase memory in MWE2 runtime configuration. &lt;/dd&gt; &lt;/dl&gt;I stumbled over this problem twice, and it is really annoying since it is very hard to find the reason. If the parser generator runs out of memory, it crashes at some arbitrary position and randomly creates error messages. Since it usually happens in the parser generator, the error messages always indicate problems in your grammar, although your grammar may be perfectly ok. So, if you got any grammar problems which are not that obvious real grammar problems, ensure to set  VM argument "-Xmx1024m" in the MWE2 runtime configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;i&gt;Disclaimer: This is more a personal note, and some problems may be fixed in the meantime. Feel free to tell me if I got something wrong here :-)&lt;/i&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-6692708026891207188?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/6692708026891207188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=6692708026891207188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6692708026891207188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6692708026891207188'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/06/when-your-mwe2-workflow-is-not-working.html' title='When your MWE2 workflow is not working...'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-7502696741414621135</id><published>2011-03-14T14:15:00.001+01:00</published><updated>2011-03-14T14:15:40.531+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Xtend'/><category scheme='http://www.blogger.com/atom/ns#' term='EMF'/><category scheme='http://www.blogger.com/atom/ns#' term='Xtext'/><title type='text'>Implement toString with Xtext's Serializer</title><content type='html'>Xtext uses EMF to generate the model API of the abstract syntax tree (or graph) of a DSL. For all implementation classes, the toString() method is generated. For a simple model element, this default implementation returns a string looking similar to this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;my.dsl.impl.SomeElement@67cee792 (attr1: SomeValue)&lt;/pre&gt;&lt;br /&gt;
Well, this is not too bad. However this looks completely different to my DSL syntax, which may look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;SomeValue { 
    The content;
}&lt;/pre&gt;&lt;br /&gt;
Especially for debugging and logging, I prefer that DSL like output. Since Xtext does not only generates a parser for reading such a text, but also a  seralizer for creating the text from a model, I was wondering if that mechanism could be used for the toString method as well. (Actually, Henrik Lindberg &lt;a href="http://www.eclipse.org/forums/index.php?t=msg&amp;goto=659266#msg_659266"&gt;pointed out&lt;/a&gt; the serializer class -- thank you, Henrik!)&lt;br /&gt;
&lt;br /&gt;
In the following, I describe how to do that. Actually, this is a little bit tricky, and it will cover several aspects of Xtext and the generation process:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;use the generated serializer for formatting a single model element&lt;/li&gt;
&lt;li&gt;tweak the generation process in order to add a new method&lt;/li&gt;
&lt;li&gt;define the body of the newly added method&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
We will do that by adding a post processor Xtend file, which adds a new operation to the DSL model elements. The body of the operation is then added using ecore annotations. But first, we will write a static helper class implementing the toString method using the serializer.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Use the serializer&lt;/h2&gt;Xtext provides a serializer class, which is usually used for writing a model to an Xtext resource. The Serializer class (in org.eclipse.xtext.parsetree.reconstr) provides a method serialize(EObject obj), which returns a String---this is exactly what we need. This class requires a parse tree constructor, a formatter and a concrete syntax validator. Thanks to google Guice, we do not have to bother about these things. Xtext generates everything required to create a nicley configured serializer for us. What we need is the Guice injector for creating the serializer:&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;Injector injector = Guice.createInjector(new  my.dsl.MyDslRuntimeModule());
Serializer serializer = injector.getInstance(Serializer.class);&lt;/pre&gt;&lt;br /&gt;
Now we could simply call the serialize method for a model element (which is to be an element of the DSL):&lt;br /&gt;
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;String s = serializer.serialize(eobj);&lt;/pre&gt;&lt;br /&gt;
Since this may throws an exception (when the eobj cannot be successfully serialized, e.g., due to missing values), we encapsulate this call in a try-catch block. Also, we create a helper class, providing a static method. We also use a static instance of the serializer.&lt;br /&gt;
Since this helper class is only to be used by the toString methods in our generated implementation, we put it into the same package. &lt;br /&gt;
&lt;br /&gt;
&lt;div style="width:97%; height:200px; overflow:auto;" class="shadowbox"&gt;&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;package my.dsl.impl;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parsetree.reconstr.Serializer;
import com.google.inject.Guice;

public class ToString {
 private static Serializer SERIALIZER = null;

 private static Serializer getSerializer() {
  if (SERIALIZER == null) { // lazy creation
   SERIALIZER = Guice.createInjector(new my.dsl.MyDslRuntimeModule())
        .getInstance(Serializer.class);
  }
  return SERIALIZER;
 }

 public static String valueOf(EObject eobj) {
  if (eobj==null) {
   return "null";
  }
  try {
   return getSerializer().serialize(eobj);
  } catch (Exception ex) { // fall back:
   return eobj.getClass().getSimpleName()+'@'+eobj.hashCode();
  }
 }

}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;h2&gt;Post processing&lt;/h2&gt;Now we have to implement the toString() method of our model classes accordingly. That is, instead of the default EMF toString method, we want to call our static helper method for producing the String. &lt;br /&gt;
&lt;br /&gt;
A generic solution, which can not only be applied for adding the toString method but for all kind of operations, is to use a post processor extension (written in Xtend) to add new operations to the generated ecore model. The overall mechanism is described in the Xtext documentation. We have to write an Xtend extension matching a specific naming convention: &amp;lt;name of DSL&gt;PostProcessor.ext. In our exampel that would be MyDslPostProcessor. &lt;br /&gt;
&lt;br /&gt;
The easy thing is to add a new operation to each classifier:&lt;br /&gt;
&lt;pre class="shadowbox"&gt;import ecore;
import xtext;

process(GeneratedMetamodel this) :
 this.ePackage.eClassifiers.addToStringOperation();

create EOperation addToStringOperation(EClassifier c):
    ... define operation ... -&gt;
 ((EClass)c).eOperations.add(this);&lt;/pre&gt;&lt;br /&gt;
For defining the operation, we need:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;the return type of the operation&lt;/li&gt;
&lt;li&gt;the body of the operation&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
The return type is an EString (which will result in a simple Java String). In EMF, we have to set the type via EOperation.setEType(EClassifier). That is, we need the classifier of EString. With Java, this would be no problem: EcorePackage.eINSTANCE.getEString().&lt;br /&gt;
Unfortunately, we cannot directly access static fields from Xtend. At least, I do not know how that works. Fortunately, we can substitute EcorePackage.eINSTANCE with calling a static method of EcorePackageImpl. This static method can then be defined as a JAVA extension in Xtend:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="shadowbox"&gt;EPackage ecorePackage(): 
 JAVA org.eclipse.emf.ecore.impl.EcorePackageImpl.init();&lt;/pre&gt;&lt;br /&gt;
Note that we return an EPackage instead of the EcorePackage. I assume this is necesssary because we use the EMF metamodel contributor and EcorePackage is not available then. We can now set the EString classifier as return type of the operation: setEType(ecorePackage().getEClassifier("EString"))&lt;br /&gt;
&lt;br /&gt;
Now, we need the body of the operation. Ecore does not directly support the definition of a body, that is there is no field in EOperation for setting the body. Fortunately, we can exploit annotations for defining the body. The default EMF generator templates look for annotations marked with the source value "http://www.eclipse.org/emf/2002/GenModel". The key of the annotation must be "body", and the value of the annotation is then used as the body of the operation. In the body, we simply call our static helper method for producing the DSL-like string representation.&lt;br /&gt;
&lt;br /&gt;
The complete post processor extensions looks as follows:&lt;br /&gt;
&lt;div style="width:97%; height:200px; overflow:auto;" class="shadowbox"&gt;&lt;pre&gt;&lt;code&gt;import ecore;
import xtext;

process(GeneratedMetamodel this) :
 this.ePackage.eClassifiers.addToStringOperation();

EPackage ecorePackage(): 
 JAVA org.eclipse.emf.ecore.impl.EcorePackageImpl.init();


create EOperation addToStringOperation(EClassifier c):
 setName("toString") -&gt;
 setEType(ecorePackage().getEClassifier("EString")) -&gt;
 eAnnotations.add(addBodyAnnotation(
  'if (eIsProxy()) return super.toString(); return ToString.valueOf(this);')) -&gt;
 ((EClass)c).eOperations.add(this);

create EAnnotation addBodyAnnotation(EOperation op, String strBody):
 setSource("http://www.eclipse.org/emf/2002/GenModel") -&gt;
 createBody(strBody) -&gt;
 op.eAnnotations.add(this);
 
create EStringToStringMapEntry createBody(EAnnotation annotation, String strBody): 
 setKey("body")-&gt;
 setValue(strBody) -&gt;
 annotation.details.add(this);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
If you (re-) run the GenerateMyDSL workflow, the EMF toString() implementations are replaced by our new version. You can test it in a simple stand alone application (do not forget to call doSetup in order to configure the injector):&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;public static void main(String[] args) {
 MyDslStandaloneSetup.doSetup();
 MyElement = MyDslFactory.eINSTANCE.createElement();
 e.setAttr1("Test");
 e.setAttr2("Type");
 System.out.println(e.toString());
}&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Closing remarks&lt;/h2&gt;&lt;br /&gt;
You probably do not want to really replace all toString methods with the serializer output, as this would create rather long output in case of container elements. In that case, you can add the new operation only to selected classifiers, or use the (generated) Switch-class to further customize the output. &lt;br /&gt;
&lt;br /&gt;
Although the solutions looks straight forward, it took me some time to solve some hidden problems and get around others:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;How to create the serializer using the injector -- and how to create the  injector in the first place&lt;/li&gt;
&lt;li&gt;How to access a static Java method from Xtend without too much overhead.  Would be great if static fields could be accessed from Xtend directly.&lt;/li&gt;
&lt;li&gt;How to use the post processor with the JavaBeans metamodel contributor. If I switch to the JavaBeans metamodel, my extension didn't get called anymore.&lt;/li&gt;
&lt;li&gt;I'm still wondering where "EStringToStringMapEntry" is defined. I "copied" that piece of code from a &lt;a href="http://jevopisdeveloperblog.blogspot.com/2009/07/user-report-migrate-from-oaw-xtext-to.html"&gt;snippet I wrote&lt;/a&gt; a couple of months ago, and I have forgotten how I found that solution in the first place.&lt;/li&gt;
&lt;li&gt;Sorry, but I have to say it: The Xtend version 1.0.1 editor is crap (e.g., error markers of solved problems do not always get removed). But I've heard there should be a better one available in version 2 ;-)&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-7502696741414621135?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/7502696741414621135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=7502696741414621135' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7502696741414621135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7502696741414621135'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/03/implement-tostring-with-xtexts.html' title='Implement toString with Xtext&apos;s Serializer'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-7277379236862494680</id><published>2011-03-04T21:27:00.002+01:00</published><updated>2011-03-05T11:19:51.387+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Xtend'/><category scheme='http://www.blogger.com/atom/ns#' term='transformation'/><title type='text'>Traverse DAGs with Xtend</title><content type='html'>Like &lt;a href="http://www.omg.org/technology/documents/modeling_spec_catalog.htm#OCL"&gt;OCL&lt;/a&gt;, &lt;a href="http://www.eclipse.org/modeling/m2t/?project=xpand"&gt;Xtend&lt;/a&gt; (a sublanguage as part of the Xpand project for model queries) provides some really powerful collection operations. These operations allow to easily retrieve elements from arbitrary models, i.e. graphs. Searching a single element in a graph is often very simple with these operation. However, when a collection is to be returned (which is not stored in some attribute), this might be a little bit more complicated, especially if the order matters. In the following, I have assembled some examples showing how to traverse a directed acyclic graph (DAG) with some common traversal strategies: &lt;p&gt;&lt;a href="#1"&gt;1)&lt;/a&gt; unsorted search traversing directed connections&lt;br /&gt;
&lt;a href="#2"&gt;2)&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Depth-first_search"&gt;depth-first search&lt;/a&gt; traversing directed connections&lt;br /&gt;
&lt;a href="#3"&gt;3)&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Breadth-first_search"&gt;breadth-first search&lt;/a&gt; traversing directed connections&lt;br /&gt;
&lt;a href="#4"&gt;4)&lt;/a&gt; traverse a directed connection in counter-direction&lt;br /&gt;
&lt;a href="#5"&gt;5)&lt;/a&gt; unsorted search, traversing directed connections in counter-direction&lt;br /&gt;
&lt;a href="#6"&gt;6)&lt;/a&gt; depth-first search traversing directed connections in counter-direction&lt;br /&gt;
&lt;a href="#7"&gt;7)&lt;/a&gt; breadth-first search traversing directed connections in counter-direction&lt;br /&gt;
&lt;/p&gt;Actually, traversing a connection in counter-direction is not really possible. What I mean by that is, that the query is to return the element of the non-navigable end of the connection. E.g., for a given directed connection x-&gt;y, x is to be returned for a given y. &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Example: a type hierarchy.&lt;/h3&gt;For the examples, I use a "real" world example: a type hierarchy. Our (very simple) model looks like that (in pseudo Java code): &lt;pre&gt;Type {
    String name;
    Collection&amp;lt;Type&gt; super;
}&lt;/pre&gt;Let's also assume a container in which all types are stored, e.g. &lt;pre&gt;Collection&amp;lt;Type&gt; allTypes;&lt;/pre&gt;In OCL, you can even retrieve all types by a simple query, however we often have some type of container defined in our model anyway (and we use Xtend here ;-) ). &lt;br /&gt;
For testing the code, I have defined a concrete example. The following type hierarchy visualizes some type instances, the super types attributes are drawn as connections: &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Cr0CFb7GLTk/TXFCsYNMAcI/AAAAAAAAAG0/MSx12jLkqYA/s1600/sample_type_hierarchy.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 193px; height: 179px;" src="http://1.bp.blogspot.com/-Cr0CFb7GLTk/TXFCsYNMAcI/AAAAAAAAAG0/MSx12jLkqYA/s320/sample_type_hierarchy.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5580314743468196290" /&gt;&lt;/a&gt; That is, we have a base type &lt;code&gt;A&lt;/code&gt;. &lt;code&gt;B&lt;/code&gt;, &lt;code&gt;C&lt;/code&gt;, and &lt;code&gt;D&lt;/code&gt; are direct subtypes of &lt;code&gt;A&lt;/code&gt;. &lt;code&gt;E&lt;/code&gt; is a subtype of &lt;code&gt;B&lt;/code&gt;. &lt;code&gt;F&lt;/code&gt; is a subtype of &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; (we allow multi inheritance ;-) ), and so on. &lt;br /&gt;
&lt;p&gt;&lt;i&gt;Preliminary remarks:&lt;/i&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;I haven't looked into any algorithm book to find the best algorithm (what ever "best" means). The solutions below are simply the one I implemented when I needed it, without much thinking about the algorithm. If you know a better solution, please let me know!&lt;/li&gt;
&lt;li&gt;I'm using &lt;code&gt;create&lt;/code&gt; extensions for simplicity and performance reasons here. If you have small (or mid sized) models, I'd assume this would be ok.&lt;/li&gt;
&lt;li&gt;Although Xtend is quite similar to OCL, the algorithms will probably not work with OCL, as OCL is side effect free (and I modify collections in the algorithms, which will not work that way with OCL).&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;&lt;h3&gt;Super type queries (or: traverse directed connection)&lt;/h3&gt;&lt;p&gt;Since we store the super types in the model, the easiest query is to retrieve the direct super types of a type. E.g., &lt;code&gt;A.super&lt;/code&gt; returns an empty list; &lt;code&gt;F.super&lt;/code&gt; returns &lt;code&gt;B, C&lt;/code&gt;. Now, lets calculate the &lt;a href="http://en.wikipedia.org/wiki/Transitive_closure"&gt;transitive closure &lt;/a&gt; of super types. This is very easy with Xtend:&lt;/p&gt;&lt;p&gt;&lt;a name="1"&gt;&lt;b&gt;1) Transitive closure of super types, unsorted:&lt;/b&gt;&lt;/a&gt; &lt;pre&gt;create Set[Type] superTypesTransitive(Type type):
 this.addAll(type.supers) -&gt;
 this.addAll(type.supers.superTypesTransitive());
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;We use a set in order to avoid duplicates, which would be added in case of multi-inheritance. This solution is straight forward. If you are not used to OCL syntax, you may be a little bit confused by the implicit syntax for the &lt;code&gt;collect&lt;/code&gt; operation: &lt;code&gt;type.supers.superTypesTransitive()&lt;/code&gt; returns &lt;code&gt;superTypesTransitive()&lt;/code&gt; for all &lt;code&gt;type.supers&lt;/code&gt; elements. &lt;br /&gt;
&lt;code&gt;J.superTypesTransitive()&lt;/code&gt; will return &lt;code&gt;F,B,C,A&lt;/code&gt;, just as expected. (J.superTypesTransitive() is just more OO-like way for writing superTypesTransitive(J). Frankly, I don't know if this is better readable, but it definitely looks cooler ;-)). The returned collection is not ordered, and often enough this is sufficient. However, sometimes we need the collection to be ordered. There are two often used strategies for traversing a tree or DAG: depth first search and breadth first search. We will implement both.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;&lt;a name="2"&gt;&lt;b&gt;2) Transitive closure of super types with depth first search order:&lt;/b&gt;&lt;/a&gt; &lt;pre&gt;create List[Type] superTypesTransitiveDFS(Type type):
 type.supers.forAll(s|
    this.add(s)-&gt;
    this.addAll(s.superTypesTransitiveDFS().reject(e|this.contains(e))) 
    !=null); 
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;As we need a sorted collection, we have to use a list instead of a set. However, we have to reject duplicates in our code now. Since Xtend does not provide a loop statement, I have used the collection operation &lt;code&gt;forAll&lt;/code&gt; here. Since the forAll operation expects a boolean expression inside, the &lt;code&gt;!=null&lt;/code&gt; part "casts" our chained expression into a boolean expressions. If you know of a nicer solution, please let me know. &lt;br /&gt;
&lt;code&gt;J.superTypesTransitiveDFS()&lt;/code&gt; will return &lt;code&gt;F,B,A,C&lt;/code&gt;.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;&lt;a name="3"&gt;&lt;b&gt;3) Transitive closure of super types with breadth first search order:&lt;/b&gt;&lt;/a&gt; &lt;pre&gt;create List[Type] superTypesTransitiveBFS(Type type):
 let todo = new java::util::ArrayList :
  todo.addAll(type.supers) -&gt; 
  bfsSuper(this, todo);
  
private Void bfsSuper(List[Type] result, List[Type] todo):
 if todo.isEmpty then
  Void
 else
  result.add(todo.first()) -&gt;
  todo.addAll(todo.first().supers.reject(e|todo.contains(e) || result.contains(e))) -&gt; 
  todo.remove(todo.first()) -&gt;
  bfsSuper(result, todo);  
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;The breadth first search is a little bit more complicated, as we need a helper list, and a helper method. Note that we cannot create an Xtend type of &lt;code&gt;List&lt;/code&gt; here, instead we have to use the Java &lt;code&gt;ArrayList&lt;/code&gt;, which is available when we use the JavaBeans Metamodel in the project's Xpand/Xtend settings. &lt;br /&gt;
&lt;code&gt;J.superTypesTransitiveBFS()&lt;/code&gt; will return &lt;code&gt;F,B,C,A&lt;/code&gt;.&lt;br /&gt;
&lt;/p&gt;&lt;h3&gt;Sub type queries (or: traverse connections in counter direction)&lt;/h3&gt;&lt;p&gt;So, we have three different queries for super types. Now we want to write the very same queries for sub types. Unfortunately, the sub type information is not directly stored in the model but must be derived instead. First, we write a simple query for the direct sub types:&lt;/p&gt;&lt;p&gt;&lt;a name="4"&gt;&lt;b&gt;4) Computes direct sub types (navigate in counter-direction):&lt;/b&gt;&lt;/a&gt; &lt;pre&gt;create Set[Type] subTypes(Type type, Collection[Type] allTypes):
 this.addAll(allTypes.select(k|k.supers.contains(type)));
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;This solution relies on the afore described queries. Frankly, I needed some time to figure it out (as I'm more an imperative and OO guy ;-) ) and I was really surprised how short (one line) it is. If you have to write that with Java, you will need a lot more lines. So, if you ever wondered why to use a special transformation language -- this is at least one argument. &lt;br /&gt;
Now, let's compute the transitive closure:&lt;/p&gt;&lt;p&gt;&lt;a name="5"&gt;&lt;b&gt;5) Transitive closure of sub types, unsorted:&lt;/b&gt;&lt;/a&gt; &lt;pre&gt;create Set[Type] subTypesTransitive(Type type, Collection[Type] allTypes):
 this.addAll(allTypes.select(k|k.superTypesTransitive().contains(type)));
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;Note that this query does not rely on the subTypes extension, but only on the super type queries. Since we use a &lt;code&gt;Set&lt;/code&gt;, we do not have to take care of duplicates. Again: A Java solution would be much longer. &lt;br /&gt;
&lt;code&gt;A.superTypesTransitive(allTypes)&lt;/code&gt; will return &lt;code&gt;B,C,E,G,H,I,J,D,F&lt;/code&gt;  &lt;br /&gt;
Now, let's implement the depth first search for sub types:&lt;/p&gt;&lt;p&gt;&lt;a name="6"&gt;&lt;b&gt;6) Transitive closure of sub types with depth first search order:&lt;/b&gt;&lt;/a&gt; &lt;pre&gt;create List[Type] subTypesTransitiveDFS(Type type, Collection[Type] allTypes):
 type.subTypes(allTypes).forAll(s|
        this.add(s)-&gt;
        this.addAll(s.subTypesTransitiveDFS(allTypes).reject(e|this.contains(e)))
    !=null);
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;Since we have implemented an extension for subTypes, the solution is quite similar to the super kind depth first search algorithm.  &lt;br /&gt;
&lt;code&gt;A.subTypesTransitiveDFS(allTypes)&lt;/code&gt; will return &lt;code&gt;B,E,F,I,J,C,D,G,H&lt;/code&gt;. Note that we cannot simply use the unsorted solution with a list instead of a set, as this will not result in a depth first search order (in our case, it would return something like &lt;code&gt;B,C,D,E,F,I,J,G,H&lt;/code&gt;). The same is true for superTypesTransitiveDFS, by the way.  Last but not least the breadth first search for sub types.&lt;/p&gt;&lt;p&gt;&lt;a name="7"&gt;&lt;b&gt;7) Transitive closure of sub types with breadth first search order:&lt;/b&gt;&lt;/a&gt; &lt;pre&gt;create List[Type] subTypesTransitiveBFS(Type type, Collection[Type] allTypes):
 let todo = new java::util::ArrayList :
  todo.addAll(type.subTypes(allTypes)) -&gt; 
  bfsSub(this, todo, allTypes);
  
private Void bfsSub(List[Type] result, List[Type] todo, Collection[Type] allTypes):
 if todo.isEmpty then
  Void
 else
  result.add(todo.first()) -&gt;
  todo.addAll(
    todo.first().subTypes(allTypes).
        reject(e|todo.contains(e) || result.contains(e))) -&gt; 
  todo.remove(todo.first()) -&gt;
  bfsSub(result, todo, allTypes); 
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;This algorithm also resembles the one for super types. By the way: I didn't find the &lt;code&gt;let&lt;/code&gt; expression explained in the documentation of Xtend (however, some examples use it). Did I miss it or is there really more OCL in Xtend as told in the docs? &lt;br /&gt;
&lt;code&gt;A.subTypesTransitiveBFS(allKinds)&lt;/code&gt; will return &lt;code&gt;B,C,D,E,F,G,H,I,J&lt;/code&gt;, which is easily validated as this is the order of the types as shown in the little figure. &lt;br /&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-7277379236862494680?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/7277379236862494680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=7277379236862494680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7277379236862494680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7277379236862494680'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/03/traverse-dacs-with-xtend.html' title='Traverse DAGs with Xtend'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-Cr0CFb7GLTk/TXFCsYNMAcI/AAAAAAAAAG0/MSx12jLkqYA/s72-c/sample_type_hierarchy.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-6877774960500487753</id><published>2011-02-08T15:08:00.004+01:00</published><updated>2011-02-08T16:43:52.489+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Xtext'/><title type='text'>Extract Xtext Project Wizard</title><content type='html'>Besides a nice parser and a powerful editor, Xtext can also generate a project wizard and a generator plugin. In this little posting I will explain how to extract the project wizard related code from the generated UI plugin -- and explain why you would want to to that in the first place.

First of all, what does the project wizard? The project wizard is useful to set up an initial project for your DSL, e.g., for creating initial templates, workflow files and to configure the project and its dependencies. The nice thing about the Xtext generated wizard is, that the template files are simply created using Xpand. It is very easy to provide custom templates and other stuff by simply modifying the Xpand file. You will find that Xpand template in the UI plugin, if you have enabled the wizard fragment in your DSL generator workflow:
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;
// project wizard (optional)
fragment = projectWizard.SimpleProjectWizardFragment {
 generatorProjectName = "${projectName}.generator"
 modelFileExtension = file.extensions
}
&lt;/pre&gt;
This code is uncommented by default.

So, Xtext generates a nice project wizard. This project wizard is found in the generated ui project. Let's say, my language is called sample.mydsl, then the wizard is created in sample.mydsl.ui, together with the powerful editor.

Now, why would I want to extract this editor from the ui plugin. Actually, because I want to use the wizard during development of my language. Sounds silly... OK, here is the longer explanation:

I find the wizard extremely useful especially if I have a project which uses code generation. Although you can use any kind of code generation technologies, you probably will often use Xpand and Xtend, as it is nicely integrated with Xtext. That is, Xtext can also generate a generator plugin with some template files and most notably a workflow file (MWE2).

Actually, the generated generator plugin looks almost similar to a plugin project created by the generated project wizard. That is, both, the generator plugin and a project wizard created DSL project, contain a folder src/model with a sample model, and also a sample MWE2 generator file. Also, both projects contain a src-gen folder, and the plugin-dependencies are set accordingly. This is no coincidence: If you use code generation for your DSL, and if you use Xpand to perform the generation, using an MWE2 workflow to trigger the generation is a very easy solution. Alternatively, you will have to write a new action or something, but the MWE2 workflow is much easier to set up. The model provided in the generator plugin is usually only used for testing purposes. That is, you write your Xpand (and Xtend) templates in the generator plugin and you can quickly test them by applying them on the models provided in the generator model folder. Later, when the generator plugin is installed, the user of the generator won't see the Xpand templates in the workspace, however they can be accessed by the MWE2 workflow of the DSL project.

During development, you probably run into the same situation as I did: You write the templates, then some things are changed in your DSL and you have do adjust the templates, or new features should be implemented, or you have forgotten some weird constellations, or you haven't written templates for all model elements. Most important: You probably will have several different models and you do not want to get the generated code to be generated in your generator plugin (as it should only define the templates, and should not contain some weird generated Java or whatever files). In my case, other guys on the project write the DSLs and I have to maintain the templates. I rarely use the generated DSL editor myself, but I often have to use the generator (and adjust the templates). Since I needed an extra project for each different case, I found myself copying the generator plugin (without the templates, but with my nicely configured MWE2 workflow) over and over again. I always had to adjust the plugin dependencies and so on. Well, a wizard would be nice in that situation. Now, you see my point? The Xtext generated project wizard is exactly what I needed -- but I need it in an Eclipse instance in which I do not have my DSL editor (and neither the DSL parser) installed, as this is the very instance I develop these things. But the wizard would come quite comfortably.

So, the idea is as follows: I extracted the wizard into a separate plugin. The wizard plugin has no dependencies to my DSL, so it can be installed without my DSL plugins installed. However, the generator, i.e. the MWE2 workflow, requires all my DSL stuff. But this is no problem, as the generator plugin is an opened project in my development workspace -- thus the MWE2 workflow (not the plugin code, but the workflow) can access the project.

Here is how to extract the project  wizard (which is not too complicated, however it may save you some minutes):

&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;assumption&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;You have an existing Xtext project, I will call it "sample.mydsl" in the following, and, of course, a generator plugin "sample.mydsl.generator" created for your DSL. Inside the generator, you have configure the MWE2 workflow.&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;generate project wizard&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;
 Enable Project Wizard Fragment in your DSL workflow, e.g. in "GenerateMyDSL.mwe2" of your DSL project:
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;
// project wizard (optional) 
fragment = projectWizard.SimpleProjectWizardFragment {
 generatorProjectName = "${projectName}.generator" 
 modelFileExtension = file.extensions
}
&lt;/pre&gt;
 Now run the workflow "GenerateMyDSL.mwe2", and disable the project wizard fragment (as we do not want to have two wizards in the end).
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;create wizard plugin&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt; Create new plugin project (e.g., sample.mydsl.ui.wizard) with and Activator, 
    check "This plugin-in will make contributions to the UI".&lt;br/&gt;
    &lt;i&gt;Important&lt;/i&gt;: Use "sample.ui.wizard" as package for the Activator (without mydsl), in order to retrieve the same
    package names as in the Xtext generated ui project.
    &lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;move wizard code to new plugin&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;Move the following classes from the generated ui plugin into the wizard -- this is the actual "extraction" of the wizard:
&lt;br/&gt;from src-gen: &lt;ul&gt;  &lt;li&gt;sample.ui.wizard.MyDSLNewProjectWizard&lt;/li&gt;
    &lt;li&gt;sample.ui.wizard.MyDSLProjectCreator&lt;/li&gt; &lt;/ul&gt;
from src: &lt;ul&gt; &lt;li&gt;sample.ui.wizard.MyDSLProjectInfo&lt;/li&gt;
    &lt;li&gt;sample.ui.wizard.MyDSLNewProject.xpt&lt;/li&gt; &lt;/ul&gt;
and copy the following classes from the generated ui plugin into the wizard plugin, put them into the wizard package:&lt;ul&gt; &lt;li&gt;sample.ui.MyDSLUiModule&lt;/li&gt; &lt;/ul&gt;
from src-gen: &lt;ul&gt; &lt;li&gt;sample.ui.MyDSLExecutableExtensionFactory &lt;/li&gt;  &lt;/ul&gt;
Also copy the plugin from the ui plugin into the wizard plugin and remove everything except the last extension with point "org.eclipse.ui.newWizards", adjust class name of extension factory according to the class in your wizard project (you will have to add a ".wizard" to the fully qualified name). 
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;configure wizard project&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;In Manifest, set singleton directive to true (if not already set) and add missing plug dependencies, e.g.
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;  
 org.eclipse.xtext.ui,
 org.eclipse.ui.editors;bundle-version="3.5.0",
 org.eclipse.ui.ide;bundle-version="3.5.0",
 org.eclipse.xtext.ui.shared,
 org.eclipse.ui,
 org.eclipse.xtext.builder,
 org.antlr.runtime,
 org.eclipse.core.runtime,
 org.eclipse.core.resources,
 org.eclipse.xtend,
 org.eclipse.xpand
&lt;/pre&gt;
Depending on your project, you may have to add other dependencies as well, e.g. de.itemis.xtext.typesystem if you use the great Xtext type system by Markus Völter.
&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;adjust the copied and moved java files&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;MyDSLUiModule&lt;/code&gt; is to be replaced completely:
&lt;div style="width:97%; height:200px; overflow:auto;"&gt;&lt;pre name="code" class="Java"&gt; 
 public class MyDSLUiModule extends AbstractGenericModule {
 
 private AbstractUIPlugin plugin;


 public MyDSLUiModule(AbstractUIPlugin plugin) {
  this.plugin = plugin;
 }
 
 public void configureLanguageName(Binder binder) {
  binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("sample.MyDSL");
 }
 
 public void configureFileExtensions(Binder binder) {
  binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("MyDSL");
 }
 
 @Override
 public void configure(Binder binder) {
  super.configure(binder);
  binder.bind(AbstractUIPlugin.class).toInstance(plugin);
  binder.bind(IDialogSettings.class).toInstance(plugin.getDialogSettings());
 }
 
 
 // contributed by org.eclipse.xtext.ui.generator.projectWizard.SimpleProjectWizardFragment
 public Class&amp;lt;? extends org.eclipse.xtext.ui.wizard.IProjectCreator&gt; bindIProjectCreator() {
  return MyDSLProjectCreator.class;
 }
}
&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MyDSLProjectCreator&lt;/code&gt; can be reused, however you may want to add some dependencies to the getRequiredBundles method, depending on the dependencies of your generated classes:
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;  
@Override
protected List&amp;lt;String&gt; getRequiredBundles() {
 List&amp;lt;String&gt; result = Lists.newArrayList(super.getRequiredBundles());
 result.add(DSL_GENERATOR_PROJECT_NAME);
 result.add("org.eclipse.jface.text");
 result.add("org.eclipse.jdt.core");
 result.add("org.eclipse.equinox.common");
 result.add("org.eclipse.core.runtime");
 return result;
}    
&lt;/pre&gt;
Actually, this list is the list of required bundles of your generated code. That is, if you generate Java code which requires a plugin "my.super.plugin", you have to add the dependency here.
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MyDSLNewProjectWizard&lt;/code&gt;: you probably have to fix a problem in getProjectInfo, simply change the fully qualified name MyDSLProjectInfo to a simple name, as we have moved the info into the same package.
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MyDSLExecutableExtensionFactor&lt;/code&gt;: fix class name of plugin activator, change getInstance().getInjector("..") to getDefault().getInjector() 
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Activator&lt;/code&gt;: Add initialization of Guice injector and add an injector attribute to the wizard's activator:
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;  
public class Activator extends AbstractUIPlugin {
    ..
    Injector injector;

 public Injector getInjector() {
  return injector;
 }

 @Override
 public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin = this;

  injector = Guice.createInjector(
  // Wizard:
   Modules.override(new MyDSLUiModule(this))
   // Workspace etc.:
    .with(new org.eclipse.xtext.ui.shared.SharedStateModule()));

 }
 ..
}
&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;b&gt;remove obsolte code from ui plugin&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;&lt;ul&gt;&lt;li&gt;remove method bindIProjectCreator in &lt;code&gt;AbstractMyDSLUiModule&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;remove the wizard extension point definition from the ui plugin.xml, as you probably do not want to have two wizards.&lt;/li&gt;
&lt;/ul&gt;&lt;/dd&gt;&lt;/dl&gt;
You can now run the wizard in the Eclipse runtime (i.e. the Eclipse started from within your initial, vanilla, installation). Of course, you can modify the Xpand template, e.g. I have simply copied and pasted the workflow of my generator plugin into that Xpand file. You may also add other adjustments as well.

Now, you can export the wizard as a plugin and install it to the dropins folder of your Eclipse installation. After restarting that instance, the wizard is available in the workspace in which you develop your DSL. As it has no dependencies to the DSL, you can create new projects, which are configure as you specified above. The workflow is working, although it probably has dependencies to your DSL (e.g., it uses the generated DSL parser), at the DSL project is an opened project in your workspace.

Side effect: Actually, you have extracted the Guice infrastructure as it is used by Xtext generated editors. So, even if you do not use your wizard as often as expected, you may have learned some stuff about this better-then-factory-pattern technology.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-6877774960500487753?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/6877774960500487753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=6877774960500487753' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6877774960500487753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6877774960500487753'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/02/extract-xtext-project-wizard.html' title='Extract Xtext Project Wizard'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-657057163026617840</id><published>2011-01-21T15:42:00.013+01:00</published><updated>2011-01-21T16:38:43.640+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Logging'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><title type='text'>Clickable logging messages</title><content type='html'>Probably everyone is using logging. The dirty way is to use System.out/err, a better solution is to use the &lt;a href="http://download.oracle.com/javase/6/docs/technotes/guides/logging/overview.html"&gt;JDK logging&lt;/a&gt; or some logging library, such as &lt;a href="http://logging.apache.org/log4j/"&gt;log4j&lt;/a&gt; (or a facade, e.g., &lt;a href="http://www.slf4j.org/"&gt;slf4j&lt;/a&gt;) -- and of course &lt;a href="http://log4e.jayefem.de/"&gt;Log4E&lt;/a&gt; to generate the logger declaration and other logging code . For rich clients and small tools, I usually use the JDK logging, as I do not have to add another library and the logging is only used for development purposes. For web (or other server) applications, in which logging is an important monitoring tool, other log libraries may be a better choice.

Anyway, when using the JDK logging facilities, the log message is written to the Eclipse console view by default. A simple log message usually looks like that:
&lt;pre class="shadowbox"&gt;Jan 14, 2011 4:36:54 PM my.project.MyClass bar
INFO: Demo
&lt;/pre&gt;
This is ok, however I usually do not need the date and time. Also, IMHO two lines for a single message waste too much of my console view space. 
I have written a small formatter, which produces the following output (scroll to the right to see the whole ouput):
&lt;pre style="color:red;" class="shadowbox" &gt;I Demo                     at my.project.MyClass.bar(&lt;u style="color:blue"&gt;MyClass.java:88&lt;/u&gt;)
&lt;/pre&gt;
That is, the date and time is omitted (as this usually is not needed for 
development purposes), and instead of printing the full logging level, abbreviations are used (I - info,W - Warning, S - Severe and so on). In case of shorter messages, the location information is printed on the same line with some tabs between message and location for better readability. The best thing about that format is, that the Eclipse console recognizes the location and makes it available as a link, which directly opens the location in the source code where the log message was produced. If you configure the console preferences to use gray for standard error text (as which the log message is interpreted due to the location format), you will something like that:
&lt;pre style="color:gray"  class="shadowbox"&gt;W Test Warning             at my.project.LoggingTest.main(&lt;u style="color:blue"&gt;LoggingTest.java:32&lt;/u&gt;)
I Test Info                at my.project.LoggingTest.main(&lt;u style="color:blue"&gt;LoggingTest.java:36&lt;/u&gt;)
&lt;/pre&gt;
Actually, I'm using this formatter for quite some years now. Today I have created an &lt;a href="http://code.google.com/a/eclipselabs.org/hosting/"&gt;eclipselabs.org&lt;/a&gt; project called &lt;a href="http://code.google.com/a/eclipselabs.org/p/delofo/"&gt;delofo&lt;/a&gt; (short for Developer Logging Formatter) with this formatter. I've chosen eclipselabs.org because the formatter is optimized for the Eclipse console view, although the project does not provide a plugin and can be used w/o Eclipse.

In the project wiki, you will find an installation guide, explaining how to globally install the formatter. By installing the formatter globally, you do not have to modify your projects in anyway.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-657057163026617840?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/657057163026617840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=657057163026617840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/657057163026617840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/657057163026617840'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2011/01/clickable-logging-messages.html' title='Clickable logging messages'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-2000369546698155921</id><published>2010-06-01T14:21:00.008+02:00</published><updated>2010-06-01T16:02:55.963+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><title type='text'>Install strictly  J2SE-1.4 compatible JRE on Mac OS X Snow Leopard</title><content type='html'>Today I tried to compile a project requiring J2SE-1.4, i.e. with 
&lt;code&gt;&lt;pre&gt;Bundle-RequiredExecutionEnvironment: J2SE-1.4&lt;/pre&gt;&lt;/code&gt;specified in its manifest.

On OS X 10.6, JRE 1.4 is no longer installed, instead, version 1.4 points to 1.6. Unfortunately, this JRE is not strictly compatible to J2SE-1.4, as I have learned from this error message:
&lt;code&gt;&lt;pre&gt;Build path specifies execution environment J2SE-1.4. 
There are no JREs installed in the workspace that are 
strictly compatible with this environment.&lt;/pre&gt;&lt;/code&gt;Simply making a selection on the 1.6 JVM in the list compatible JREs in &lt;i&gt;Preferences / Java / Installed JREs / Execution Environment / J2SE-1.4&lt;/i&gt; doesn't help (I tried to clean the projects, but 1.6 is not &lt;em&gt;strictly&lt;/em&gt; compatible, thus clean doesn't help here).

So, I had to install JDK 1.4, which probably is no problem for Windows and Linux users. However, on OS X, you'll have to follow the hints explained at &lt;a href="http://www.macosxhints.com/article.php?story=20100123192950640"&gt;www.macosxhints.com&lt;/a&gt; and repeated here for your convenience:&lt;ol&gt;&lt;li&gt;Remove symbolic links in &lt;code&gt;/System/Library/Frameworks/JavaVM.framework/Versions/&lt;/code&gt;  pointing from 1.4.* to 1.6 (otherwise, the 1.6 JDK will be overwritten). E.g, in the terminal (with admin rights):
&lt;code&gt;&lt;pre&gt;&gt; cd /System/Library/Frameworks/JavaVM.framework/Versions/
&gt; sudo rm 1.4*&lt;/pre&gt;&lt;/code&gt;&lt;/li&gt;&lt;li&gt;Download &lt;a href="http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_4"&gt;http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_4&lt;/a&gt;. Yeah, it is still available, but Apple doesn't make live easy for Java developers these days: &lt;em&gt;Do not install this package&lt;/em&gt; (as it will overwrite your existing Java versions)! See next step instead&lt;/li&gt;&lt;li&gt;Open downloaded pkg with &lt;a href="http://www.charlessoft.com/"&gt;Pacifist (http://www.charlessoft.com/)&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;Select JDK 1.4 and 1.4.2, and install it to default location via Pacifist's context menu (see screenshot)
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_xki1C_H6jyM/TAT_7cOZhVI/AAAAAAAAAGc/GeS_iKad0Jw/s1600/Pacifist.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 160px; height: 200px;" src="http://1.bp.blogspot.com/_xki1C_H6jyM/TAT_7cOZhVI/AAAAAAAAAGc/GeS_iKad0Jw/s200/Pacifist.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5477784443443316050" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;Now, JDK 1.4 is installed on OS X 10.6. We only have to let Eclipse (in my case 3.6RC1)  know about it:

In Eclipse, select &lt;i&gt;Preferences / Java / Installed JREs / Add Standard VM&lt;/i&gt;
Enter JRE Home: &lt;code&gt;/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home&lt;/code&gt;
and JRE Name: &lt;code&gt;JVM 1.4&lt;/code&gt; (or whatever)

You will have to close Preferences (&lt;i&gt;OK&lt;/i&gt;), and reopen it in order to let the newly added JRE to be added to the list of compatible JREs. In
&lt;i&gt;Preferences / Java / Installed JREs / Execution Environments / J2SE-1.4&lt;/i&gt;
select JVM 1.4 (now marked with "perfect match") in list of compatible JREs. That's it.

Ted Wise provides zipped versions of JVM 1.5 and 1.4, and you may install these versions following his description at &lt;a href="http://tedwise.com/2009/09/25/using-java-1-5-and-java-1-4-on-snow-leopard/"&gt;http://tedwise.com/2009/09/25/using-java-1-5-and-java-1-4-on-snow-leopard/&lt;/a&gt;. In that case, you won't need Pacifist.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-2000369546698155921?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/2000369546698155921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=2000369546698155921' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/2000369546698155921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/2000369546698155921'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2010/06/install-strictly-j2se-14-compatible-jre.html' title='Install strictly  J2SE-1.4 compatible JRE on Mac OS X Snow Leopard'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_xki1C_H6jyM/TAT_7cOZhVI/AAAAAAAAAGc/GeS_iKad0Jw/s72-c/Pacifist.png' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-6100290959641614426</id><published>2010-03-20T20:55:00.005+01:00</published><updated>2010-03-20T21:22:49.030+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='e4'/><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>Quick test: GEF3D and e4 1.0 M4</title><content type='html'>Yesterday I posted my experiences of getting GEF3D running on e4 0.9. This is only a quick update for e4 1.0 M4.

Remy Chi Jian Suen pointed me to e4 1.0 M4, and I followed the instruction on the &lt;a href="http://wiki.eclipse.org/E4/Compatibility/Running_the_compatibility_layer"&gt;Wiki&lt;/a&gt; page Remy linked to. 

Unfortunately, I did not succeed installing GMF with e4 1.0 M4 because there were always some unsatisfy dependencies errors. So I wasn't able to reproduce the NPE I described in the blog, and I wasn't able to test the Ecore Tools 3D example.

I'm not personally using e4, so at the moment getting GEF3D running on e4 is not my first priority and I didn't investigate any further. Besides, I got a lot of exceptions in the e4 runtime, after restarting the runtime several times it didn't started at all. I get tons of "!MESSAGE unsupported:" messages, and when trying to create a new project with the context menu, the "new"-submenu is missing, finally I get another NPE:
&lt;pre&gt;
java.lang.NullPointerException
 at org.eclipse.ui.internal.e4.compatibility.WorkbenchPage.getNewWizardShortcuts(WorkbenchPage.java:1172)
 at org.eclipse.ui.actions.BaseNewWizardMenu.addShortcuts(BaseNewWizardMenu.java:142)
 at org.eclipse.ui.actions.NewWizardMenu.addItems(NewWizardMenu.java:129)
 at org.eclipse.ui.actions.BaseNewWizardMenu.getContributionItems(BaseNewWizardMenu.java:205)
...
&lt;/pre&gt;

I don't know how but after switching the perspective I was able to create at least a simple project, and then the new-submenu was available enabling me to create a GEF3D graph example. So I got GEF3D to run with 1.0 M4 (proofed by screenshot ;-) ), however I found a severe problem with GEF 3.6 and I filed a bug report about that (&lt;a href="http://bugs.eclipse.org/306609"&gt;# 306609&lt;/a&gt;). I had to fix that in order to get GEF3D running. Actually, this problem is a GEF3D blocker and I really hope the GEF team can solve that issue. As a matter of fact I'm glad to have found that bug now. I hope it's not too late for the final 3.6 version.

&lt;div style="text-align:center"&gt;&lt;a href="http://1.bp.blogspot.com/_xki1C_H6jyM/S6UpkY-YicI/AAAAAAAAAGE/QoM-DICpPIA/s1600-h/GEF3D+on+e4+1.0M4.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;width: 320px; height: 199px;" src="http://1.bp.blogspot.com/_xki1C_H6jyM/S6UpkY-YicI/AAAAAAAAAGE/QoM-DICpPIA/s320/GEF3D+on+e4+1.0M4.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5450808629157988802" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;GEF3D on e4 1.0M4! Do you see the level-of-detail effect , i.e. labels on back planes are omitted! (Again kudos to Kristian ;-) )&lt;/span&gt;&lt;/div&gt;

Boris asked me to file a bug report, but frankly I don't know where to start... I could create a bug report about the NPE I described in my previous post, but I'd assume 0.9 is a little bit out-dated, isn't it?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-6100290959641614426?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/6100290959641614426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=6100290959641614426' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6100290959641614426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6100290959641614426'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2010/03/quick-test-gef3d-and-e4-10-m4.html' title='Quick test: GEF3D and e4 1.0 M4'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_xki1C_H6jyM/S6UpkY-YicI/AAAAAAAAAGE/QoM-DICpPIA/s72-c/GEF3D+on+e4+1.0M4.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-8505157478480924657</id><published>2010-03-19T16:44:00.007+01:00</published><updated>2010-03-19T17:28:10.264+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='e4'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>Quick test: GEF3D and e4</title><content type='html'>Today I received an email from someone asking whether &lt;a href="http://eclipse.org/gef3d/"&gt;GEF3D&lt;/a&gt; will work with &lt;a href="http://eclipse.org/e4/"&gt;e4&lt;/a&gt;. Since GEF3D is "only" an extension of GEF (and GMF), I assumed it will work. In order to be sure, I tried it myself. This is my installation log:

&lt;span style="font-weight:bold;"&gt;Step 1)&lt;/span&gt; Downloaded the e4 0.9 release (&lt;a href="http://download.eclipse.org/e4/downloads/drops/R-0.9-200907291930/index.html#EclipseE4"&gt;http://download.eclipse.org/e4/downloads/drops/R-0.9-200907291930/index.html#EclipseE4&lt;/a&gt;), in my case the Mac OS X Cocoa version

&lt;span style="font-weight:bold;"&gt;Step 2)&lt;/span&gt; Installed the following features via the given update sites:&lt;ul&gt;
&lt;li&gt;Subclipse (1.6.x): &lt;a href="http://subclipse.tigris.org/update_1.6.x"&gt;http://subclipse.tigris.org/update_1.6.x&lt;/a&gt;
&lt;li&gt;LWJGL (2.2.1): &lt;a href="http://lwjgl.org/update"&gt;http://lwjgl.org/update&lt;/a&gt;
&lt;li&gt;EMF Transactions (1.3.1): &lt;a href="http://download.eclipse.org/modeling/emf/updates/releases/"&gt;http://download.eclipse.org/modeling/emf/updates/releases/&lt;/a&gt;
&lt;/ul&gt;

&lt;span style="font-weight:bold;"&gt;Step 3)&lt;/span&gt; Imported GEF3D team project set found at &lt;a href="http://eclipse.org/gef3d/resources/GEF3D.psf"&gt;http://eclipse.org/gef3d/resources/GEF3D.psf&lt;/a&gt;

State: The 3D graph example is working, see screenshot.

&lt;div style="text-align:center"&gt;&lt;a href="http://3.bp.blogspot.com/_xki1C_H6jyM/S6OdXMOltEI/AAAAAAAAAF8/Fi2xfyqVWP4/"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;width: 320px; height: 246px;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/S6OdXMOltEI/AAAAAAAAAF8/Fi2xfyqVWP4/s320/Graph3DonE4.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5450372995793400898" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;GEF3D on e4! (Note the nice vector based fonts :-D Kudos to Kristian!)&lt;/span&gt;&lt;/div&gt;

&lt;span style="font-weight:bold;"&gt;Step 4)&lt;/span&gt; Now installed the missing features in order to test all examples:&lt;ul&gt;
&lt;li&gt;GMF SDK 2.2.1 from Galileo update site - &lt;a href="http://download.eclipse.org/releases/galileo"&gt;http://download.eclipse.org/releases/galileo&lt;/a&gt; (note: versions from &lt;a href="http://download.eclipse.org/modeling/gmf/updates/releases/"&gt;http://download.eclipse.org/modeling/gmf/updates/releases/&lt;/a&gt; require Draw2D 3.5.2, but e4 0.9 comes with 3.5.0)
&lt;li&gt;Ecore Tools (0.9.0): &lt;a href="http://download.eclipse.org/modeling/emft/updates/releases/"&gt;http://download.eclipse.org/modeling/emft/updates/releases/&lt;/a&gt;
&lt;li&gt; UML2 (3.0.1) and UML Tools (0.9.0): &lt;a href="http://download.eclipse.org/modeling/mdt/updates/releases/"&gt;http://download.eclipse.org/modeling/mdt/updates/releases/&lt;/a&gt; 
&lt;/ul&gt;

Restarted e4 after downloading these bundles. Ups, what's that? My toolbar has gone...? Where is it? However, I doubt GEF3D or GMF to be involved in that bug... Hmm... was there a toolbar before step 4)? Weird.

UML2 Tools and Ecore Tools are working, at least the 2D versions. 

Unfortunately, the 3D versions are not working. There are not much error messages: 
&lt;pre&gt;
java.lang.NullPointerException
at org.eclipse.e4.extensions.LegacyPartRenderer.createEditor(LegacyPartRenderer.java:95)
at org.eclipse.e4.extensions.LegacyPartRenderer.createWidget(LegacyPartRenderer.java:357)
...
&lt;/pre&gt;

I didn't analyzed that error... without a toolbar, it's not very comfortable. Besides, I didn't found the code of LegacyPartRenderer and I didn't find a way to declare an exception breakpoint. 

Summary: Since the 3D graph example is working, I assume GEF3D and e4 should work in general (e4 does change the workbench, but not SWT or GEF). However, the 3D-fied UML2 and Ecore editors are not working, but I have no idea why they don't. Maybe it's not e4 but a problem with the latest GMF or ecore tools versions, I don't know. 

Frankly, I have ignored e4 for the time being (simply because I haven't had the time). IMHO you cannot simply install  existing 3.x plugins and expect them to work with a 0.9 incubator framework. In so far I'm happy about the 3D graph example running! Besides, I assume my test only tested the legacy layer of e4, and not e4 itself. However, I'm still wondering why the 2D version of the ecore diagram editor is working and why the 3D version isn't. I'd assume there exist documents in the e4 project about how to solve problems like this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-8505157478480924657?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/8505157478480924657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=8505157478480924657' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/8505157478480924657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/8505157478480924657'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2010/03/quick-test-gef3d-and-e4.html' title='Quick test: GEF3D and e4'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xki1C_H6jyM/S6OdXMOltEI/AAAAAAAAAF8/Fi2xfyqVWP4/s72-c/Graph3DonE4.png' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-6242015161933265913</id><published>2010-01-19T11:47:00.018+01:00</published><updated>2010-01-19T18:51:43.648+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCL'/><category scheme='http://www.blogger.com/atom/ns#' term='MDD'/><category scheme='http://www.blogger.com/atom/ns#' term='EMF'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Xtext'/><title type='text'>Quick'n Dirty Tutorial on Modelling with Eclipse</title><content type='html'>A friend of mine asked me how to modelling with Eclipse. I gave him a quick tour, demonstrating how to create a model with EMF, how to create an instance of that model, how to query the model with OCL, and how to create a text editor for that model with Xtext. It's pure modelling, i.e. no Java programming at all! I thought that maybe other people would be interested in that topic as well, so I created this little tutorial showing how all these Eclipse modelling "ingredients" can work together.
&lt;!-- ************************************************************************************************************* --&gt;
&lt;h3&gt;Preparations&lt;/h3&gt;
Install Eclipse 3.5 (Galileo) with all the modelling tools, that is the &lt;b&gt;Galileo Eclipse Modeling Tools package&lt;/b&gt;. Additionally, we will need the OCL interpreter console, which can be installed using the MDT update site: &lt;br/&gt;&lt;a href="http://download.eclipse.org/modeling/mdt/updates/releases/"&gt;http://download.eclipse.org/modeling/mdt/updates/releases/&lt;/a&gt;&lt;br/&gt;The OCL console actually is an example, so you will have to install that specific example.
&lt;!-- ************************************************************************************************************* --&gt;
&lt;h3&gt;The Runtime Example&lt;/h3&gt;
Let's assume a small IT company. The employees of that company develop software for other companies. Of course, they use models for that purpose! In order to better organize their work, they want to document who is working on what. That is, they want to assign certain task to developers. A task could be the implementation of a use case or writing a test case for a class. Let's see if we can use models for that...
&lt;!-- ************************************************************************************************************* --&gt;
&lt;h3&gt;Company Model with EMF&lt;/h3&gt;
First of all, we have to create a model describing the company. Let's start from scratch:&lt;ol start="1"&gt;
&lt;li&gt;create a new project:&lt;br/&gt;&lt;i&gt;File / New / Project... / Eclipse Modeling Framework /&lt;b&gt;Empty EMF project&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;create a new ecore diagram (we want to graphically design the model) in the newly created model folder: Right click on model folder and select &lt;br/&gt;&lt;i&gt;New / Other... / Ecore Tools / &lt;b&gt;Ecore Diagram&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;enter the &lt;i&gt;Domain file name:&lt;/i&gt;: &lt;code&gt;company.ecore&lt;/code&gt; and press &lt;i&gt;&lt;b&gt;Finish&lt;/b&gt;&lt;/i&gt;.
&lt;/ol&gt;
Now, we can "draw" our model using the graphical editor. Create four classes (&lt;i&gt;EClass&lt;/i&gt;), add a name attribute (&lt;i&gt;EAttribute&lt;/i&gt;) to one of them, create references (&lt;i&gt;EReference&lt;/i&gt;) between the classes, and set the properties (in the properties view, this view can be activated by right-clicking in the diagram and select &lt;i&gt;&lt;b&gt;Show Properties View&lt;/b&gt;&lt;/i&gt;. The result should look like Figure 1.
&lt;div style="text-align:center;"&gt;&lt;a href="http://2.bp.blogspot.com/_xki1C_H6jyM/S1W_k0Jrz0I/AAAAAAAAAD4/CQ_M0ujJo38/s1600-h/qdmodelling_01.png"&gt;&lt;img style="display:block;text-align:center;margin:0px auto 10px;width: 320px; height: 232px;" src="http://2.bp.blogspot.com/_xki1C_H6jyM/S1W_k0Jrz0I/AAAAAAAAAD4/CQ_M0ujJo38/s320/qdmodelling_01.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428455565060460354" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 1: The domain model of a company&lt;/span&gt;&lt;/div&gt;
Some remarks:&lt;ul&gt;
&lt;li&gt;The model is an instance of the &lt;b&gt;ecore&lt;/b&gt; model, which is quite similar to class models in UML. All elements in ecore start with an "E", so it is &lt;b&gt;E&lt;/b&gt;Class, &lt;b&gt;E&lt;/b&gt;Attribute, or &lt;b&gt;E&lt;/b&gt;String.&lt;/li&gt;
&lt;li&gt;The &lt;b&gt;E&lt;/b&gt;Type of the attribute &lt;code&gt;name&lt;/code&gt; is &lt;b&gt;E&lt;/b&gt;String.&lt;/li&gt;
&lt;li&gt;The upper bound of all references is "*" (you can enter "-1", which actually is the same as "*").&lt;/li&gt;
&lt;li&gt;You will need a class containing all your elements later. In the example, the &lt;code&gt;Company&lt;/code&gt; serves as a container. Make sure the &lt;i&gt;&lt;b&gt;Is Containment&lt;/b&gt;&lt;/i&gt; flag is set for the two references &lt;code&gt;employees&lt;/code&gt; and &lt;code&gt;skills&lt;/code&gt; (see Fig. 1)&lt;/li&gt;
&lt;/ul&gt;
Now that we have created a model of our company, we can create an instance of that model. Later, we will generate an editor, but right now we want to quickly create an instance to get a feeling for our model. An instance of our model actually is an instance of our container element, that is the &lt;code&gt;Company&lt;/code&gt; class. There is a generic editor available, which can create an instance of a model (or its elements) directly without the need of code generation. All you need is the ecore model. This is how to activate it:&lt;ol  start="4"&gt;
&lt;li&gt;Close the ecore diagram&lt;/li&gt;
&lt;li&gt;Open the ecore model, this time use the &lt;i&gt;Sample Ecore Model Editor&lt;/i&gt;. Usually, this editor is used if you double-click the ecore-file, but to be sure use the &lt;i&gt;Open With...&lt;/i&gt; context menu entry.&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;Company&lt;/code&gt; class (the class, not the package!), and select &lt;i&gt;&lt;b&gt;Create Dynamic Instance...&lt;/b&gt;&lt;/i&gt; from its context menu. This is shown in Figure 2.
&lt;div style="text-align:center"&gt;&lt;a href="http://2.bp.blogspot.com/_xki1C_H6jyM/S1W_2P5mrII/AAAAAAAAAEA/6yEz_ej_z-w/s1600-h/qdmodelling_02.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 232px;" src="http://2.bp.blogspot.com/_xki1C_H6jyM/S1W_2P5mrII/AAAAAAAAAEA/6yEz_ej_z-w/s320/qdmodelling_02.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428455864566983810" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 2: Create a dynamic instance.&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;enter the &lt;i&gt;File name:&lt;/i&gt; &lt;code&gt;Company.xmi&lt;/code&gt; and press &lt;i&gt;&lt;b&gt;Finish&lt;/b&gt;&lt;/i&gt;. The instance will be created in the model folder.&lt;/li&gt;
&lt;li&gt;edit the model instance using the context menus &lt;i&gt;New Child&lt;/i&gt; of the elements in the model.&lt;/li&gt;
&lt;li&gt;edit the elements properties in the properties section of the editor, see Figure 3.
&lt;div style="text-align:center"&gt;&lt;a href="http://4.bp.blogspot.com/_xki1C_H6jyM/S1W_2UwHosI/AAAAAAAAAEI/RARP0WvaiUY/s1600-h/qdmodelling_03.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 232px;" src="http://4.bp.blogspot.com/_xki1C_H6jyM/S1W_2UwHosI/AAAAAAAAAEI/RARP0WvaiUY/s320/qdmodelling_03.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428455865869378242" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 3: Edit properties with the &lt;i&gt;Generic EMF Form Editor&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
Now that we have create a model and an instance of that model, we want to "work" with that model instance. E.g., we can use OCL to query the model: &lt;ol start="10"&gt;
&lt;li&gt;Activate the console view and open the &lt;i&gt;&lt;b&gt;Interactive OCL&lt;/b&gt;&lt;/i&gt; console with the button on the left of the console, see Figure 4.
&lt;div style="text-align:center"&gt;&lt;a href="http://4.bp.blogspot.com/_xki1C_H6jyM/S1XAA6aNxmI/AAAAAAAAAEQ/70TUGTM7QHQ/s1600-h/qdmodelling_04.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 232px;" src="http://4.bp.blogspot.com/_xki1C_H6jyM/S1XAA6aNxmI/AAAAAAAAAEQ/70TUGTM7QHQ/s320/qdmodelling_04.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428456047776745058" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 4: Open OCL interpreter console&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Select an element in the editor, This selected element is the &lt;i&gt;context&lt;/i&gt; of the OCL query.&lt;/li&gt;
&lt;li&gt;Enter your OCL query in the console (in the lower section of the OCL interpreter console). E.g. query the name of the selected element with &lt;code&gt;self.name&lt;/code&gt;. The result will be displayed in the upper section of the OCL console as shown in Figure 5. We will demonstrate other queries later on.
&lt;div style="text-align:center"&gt;&lt;a href="http://2.bp.blogspot.com/_xki1C_H6jyM/S1XABN5ibkI/AAAAAAAAAEY/cGHWR5x0Wkw/s1600-h/qdmodelling_05.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 232px;" src="http://2.bp.blogspot.com/_xki1C_H6jyM/S1XABN5ibkI/AAAAAAAAAEY/cGHWR5x0Wkw/s320/qdmodelling_05.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428456053008395842" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 5: Query the model instance with OCL&lt;/span&gt;&lt;/div&gt;
 &lt;/li&gt;
&lt;/ol&gt;
&lt;!-- ************************************************************************************************************* --&gt;
&lt;h3&gt;Task Model with Xtext&lt;/h3&gt;
Now that we have a model of our company, we want to assign tasks to the employees. We could create a new ecore model just as demonstrated above, but we want to try something new. So, let's try to not only create a model, but a text editor as well. For that, we will use Xtext. Based on a grammar, Xtext can create an ecore model and a text editor with nice features. The grammar is an annotated EBNF grammar, I do not want to go into the details here (otherwise it wouldn't be a q'n d-tutorial ;-) ). So, we have to create a new project and enter a grammar:&lt;ol start="13"&gt;
&lt;li&gt;Create a new Xtext project: &lt;br/&gt;&lt;i&gt;File / New / Project... / Xtext /&lt;b&gt;Xtext Project&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;Set&lt;i&gt;Main project name&lt;/i&gt;, the &lt;i&gt;Language name&lt;/i&gt; (to &lt;code&gt;de.feu.Tasks&lt;/code&gt;), and the &lt;i&gt;DSL-File extension&lt;/i&gt; (to &lt;code&gt;tasks&lt;/code&gt;).&lt;/li&gt; &lt;!-- p18 --&gt;
&lt;li&gt;Open &lt;code&gt;Tasks.xtext&lt;/code&gt; (this is the EBNF-like grammar) and enter your grammar according to Figure 6.
&lt;div style="text-align:center"&gt;&lt;a href="http://2.bp.blogspot.com/_xki1C_H6jyM/S1XH8vZYbaI/AAAAAAAAAFQ/X8xabul1IVk/s1600-h/qdmodelling_06.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 188px;" src="http://2.bp.blogspot.com/_xki1C_H6jyM/S1XH8vZYbaI/AAAAAAAAAFQ/X8xabul1IVk/s320/qdmodelling_06.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428464772194004386" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 6: Xtext grammar defining our task model along with a concrete textual syntax&lt;/span&gt;&lt;/div&gt;
Here is the grammer (for copy &amp;amp; paste):
&lt;div style="width:97%; height:100px; overflow:auto;"&gt;&lt;pre name="code" class="Xtext"&gt;
grammar de.feu.Tasks with org.eclipse.xtext.common.Terminals

import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "platform:/resource/de.feu.company/model/company.ecore" as company

generate tasks "http://www.feu.de/Tasks"

Tasks :
 (developers+=Developers)*
 (domainmodels+=DomainModels)*
 (tasks+=Task)*;
 
Developers :
 'developer' importURI=STRING;
 
DomainModels :
 'domainmodel' importURI=STRING;


Task: 'task' element=[ecore::EObject] 
   'by' developer=[company::Developer] 
   ':' description=STRING;
&lt;/pre&gt;&lt;/div&gt;
This grammar defines a container element &lt;code&gt;Tasks&lt;/code&gt;. Inside, we can "load" a list of developers and domain models. Eventually, tasks can be defined by assigning an element from a domain model (see &lt;code&gt;element=[ecore::EObject]&lt;/code&gt;) to a developer (&lt;code&gt;developer=[company::Developer]&lt;/code&gt;) and add a description of that task.
&lt;/li&gt;
&lt;li&gt;Save the gammar and generate the ecore model along with the text editor using the MWE-workflow. For that, select file &lt;code&gt;GenerateTasks.mwe&lt;/code&gt; and run the workflow via its context menu &lt;i&gt;Run As / &lt;b&gt;MWE Workflow&lt;/b&gt;&lt;/i&gt;&lt;/li&gt;
&lt;/ol&gt;
Notes:&lt;ul&gt;
&lt;li&gt;In Xtext, a model is called a DSL. Experts like to use different names for "model", sometimes it's cooler to call a model "meta-model" (or, even cooler, "meta-meta-model"), sometimes they call it "domain specific language", abbreviated with a nice TLA (three letter acronym): DSL. Of course, there are good (and sometimes not so good) reasons for doing so, but usually it's easier to simply call a model a model (and an "instance of a model" an "instance of a model") .&lt;/li&gt;
&lt;li&gt;The grammar shown in Figure 6 actually uses a lot of nice Xtext features and you will have to read the Xtext documentation for details. I only want to explain one thing here, which is a little bit advanced. You can import existing models into the grammar (&lt;code&gt;import ...&lt;/code&gt;). In the example, we import the ecore model and our previously created company model. We import these models in order to be able to define inter-model references later on. Our &lt;code&gt;Task&lt;/code&gt; element will refer to an &lt;code&gt;element&lt;/code&gt;, which can be any &lt;code&gt;ecore::EObject&lt;/code&gt;, and the &lt;code&gt;developer&lt;/code&gt; is to one developer defined in our company model (&lt;code&gt;company::Developer&lt;/code&gt;). EMF supports inter-model-references, and Xtext generated editors support that feature as well! The &lt;code&gt;import&lt;/code&gt; statements in our grammar only import the models, but later on we want to actually import existing model instances. For that, we need the &lt;code&gt;importURI&lt;/code&gt; feature of Xtext to define what instance to import in our actual task model instance.&lt;/li&gt;
&lt;/ul&gt;
Although we haven't written a single line of Java code yet, a lot of code has been generated automatically. In order to "activate" that code, which actually defines a new Eclispe plugin, we have to start a new runtime instance of Eclipse, that is we start Eclipse from within Eclipse. In the long run, you will have to get used to Eclipse plugin development anyway...

As we have to run a new instance anyway, we can generate an editor for our company model as well. Instead of using a dynamically created instance using the "Generic EMF Form Editor", EMF can generate a Java implementation of the model and an editor as well. We will do that now:&lt;ol start="17"&gt;
&lt;li&gt;Select the &lt;code&gt;company.ecore&lt;/code&gt; file and choose &lt;i&gt;New / Other... / Eclipse Modeling Framework / &lt;b&gt;EMF Generator Model&lt;/b&gt;&lt;/i&gt; from its context menu. Use the suggested file name, select &lt;i&gt;&lt;b&gt;Ecore Model&lt;/b&gt;&lt;/i&gt; in the next wizard page. Then, press &lt;i&gt;Load&lt;/i&gt; in the next page, and eventually &lt;i&gt;Finish&lt;/i&gt; on the last wizard page. This creates a generator model, which basically adds some information to the original ecore model which is necessary in order to actually generate code (e.g., the name of the plugins and so on). We do not want to change anything here, but we still need that model.&lt;/li&gt;
&lt;li&gt;In that model, select the very first element (&lt;code&gt;Company&lt;/code&gt;) and select &lt;i&gt;&lt;b&gt;Generate All&lt;/b&gt;&lt;/i&gt; from its context menu (see Figure 7).
&lt;div style="text-align:center"&gt;&lt;a href="http://1.bp.blogspot.com/_xki1C_H6jyM/S1XABozDpoI/AAAAAAAAAEo/0QbejRqSEsc/s1600-h/qdmodelling_07.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 202px;" src="http://1.bp.blogspot.com/_xki1C_H6jyM/S1XABozDpoI/AAAAAAAAAEo/0QbejRqSEsc/s320/qdmodelling_07.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428456060228970114" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 7 Generate the model and editor code&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- ************************************************************************************************************* --&gt;
&lt;h3&gt;Work with Multiple Models&lt;/h3&gt;
Now that we have generate a lot of code, we want to use the newly created tools. Start a new Eclipse runtime instance (e.g. by selecting &lt;i&gt;Run As / Eclipse Application&lt;/i&gt; from a project context menu) and do the following:&lt;ol start="19"&gt;
&lt;li&gt;Create a new project (in the runtime instance):&lt;br/&gt;&lt;i&gt;File / New / Project... / General /Project&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;Select the project and choose from its context menu: &lt;br/&gt;&lt;i&gt;New / Other... / Example EMF Model Creation Wizard / &lt;b&gt;Company Model&lt;/b&gt;&lt;/i&gt;&lt;br/&gt;This activates our previously generated editor (and a wizard) for creating a company model instance. We can edit a company instance just as we did it with the generic editor. In the wizard, select the &lt;i&gt;Model Object&lt;/i&gt; &lt;code&gt;Company&lt;/code&gt; and then create a new company as shown in Figure 8. (Don't forget to save the model ;-) ).
&lt;div style="text-align:center"&gt;&lt;a href="http://4.bp.blogspot.com/_xki1C_H6jyM/S1XABz0ZoPI/AAAAAAAAAEw/dJ-AnCNn-Dc/s1600-h/qdmodelling_08.png"&gt;&lt;img style="display:block; margin:0px auto 10px;width: 320px; height: 273px;" src="http://4.bp.blogspot.com/_xki1C_H6jyM/S1XABz0ZoPI/AAAAAAAAAEw/dJ-AnCNn-Dc/s320/qdmodelling_08.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428456063187394802" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 8: A company model, edited with the generated editor&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Now, create a new file (&lt;i&gt;File / New / File&lt;/i&gt;) inside the project and call it &lt;code&gt;project&lt;b&gt;.tasks&lt;/b&gt;&lt;/code&gt;. The Xtext generated editor is opened automatically and we can now edit the task model instance.&lt;/li&gt;
&lt;li&gt;In order to "simulate" a project, we create a simple UML use case model. Simply create a new use case diagram via &lt;i&gt;File / New / Other... / UML 2.1 Diagrams / &lt;b&gt;Use Case Diagram&lt;/b&gt;&lt;/i&gt;, give it a name (e.g. &lt;code&gt;project_usecase&lt;/code&gt;) and draw some use cases, a sample is shown in Figure 9.
&lt;div style="text-align:center"&gt;&lt;a href="http://3.bp.blogspot.com/_xki1C_H6jyM/S1XAKnrF4rI/AAAAAAAAAE4/IEzMv67JN6Y/s1600-h/qdmodelling_09.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 254px;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/S1XAKnrF4rI/AAAAAAAAAE4/IEzMv67JN6Y/s320/qdmodelling_09.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428456214545949362" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 9: A sample use case diagram&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Switch back to &lt;code&gt;project.tasks&lt;/code&gt; and "import" our company model and the sample use cases. Add a task using content assist (&lt;i&gt;Ctrl-Space&lt;/i&gt;) just as shown in Figure 10. Just play around, add three or four tasks in order to be able to follow the next steps.
&lt;div style="text-align:center"&gt;&lt;a href="http://4.bp.blogspot.com/_xki1C_H6jyM/S1XAKwGRu3I/AAAAAAAAAFA/avWC4a9JlaU/s1600-h/qdmodelling_10.png"&gt;&lt;img style="display:block;text-align:center; margin:0px auto 10px;width: 320px; height: 254px;" src="http://4.bp.blogspot.com/_xki1C_H6jyM/S1XAKwGRu3I/AAAAAAAAAFA/avWC4a9JlaU/s320/qdmodelling_10.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428456216807455602" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 10: Content assist, demonstrating access to imported models&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Just as at the beginning, we want to execute some OCL queries on our model, but this time on our &lt;code&gt;project.task&lt;/code&gt; model instance. For OCL, we always need a context, but unfortunately we cannot select a context (or model element) in the text editor. So we have to reopen the &lt;code&gt;project.task&lt;/code&gt; with the generic EMF editor: Choose from its context menu &lt;i&gt;Open With / Other... / &lt;b&gt;Generic EMF Form Editor&lt;/b&gt;&lt;/i&gt;. You will now see the very same model as in the text editor, but this time you see a tree-based version of the model.&lt;/li&gt;
&lt;li&gt;Open the OCL console just as above, select an element (here &lt;code&gt;Tasks&lt;/code&gt;) and enter a query. For example, we want to know how much tasks are assigned to a specific developer: &lt;code&gt;self.tasks-&gt;select(developer.name='Jens')-&gt;size()&lt;/code&gt;. You can see that in Figure 11
&lt;div style="text-align:center"&gt;&lt;a href="http://1.bp.blogspot.com/_xki1C_H6jyM/S1XAK24q66I/AAAAAAAAAFI/WC_so6WlRZQ/s1600-h/qdmodelling_11.png"&gt;&lt;img style="display:block; margin:0px auto 10px;width: 320px; height: 258px;" src="http://1.bp.blogspot.com/_xki1C_H6jyM/S1XAK24q66I/AAAAAAAAAFI/WC_so6WlRZQ/s320/qdmodelling_11.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5428456218629434274" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Figure 11 A little more sensible OCL query&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- ************************************************************************************************************* --&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
IMHO it is impressing what you can do with all these cool Eclipse modelling tools, without writing a single line of (Java) code. We saw how to&lt;ul&gt;
&lt;li&gt;create an &lt;a href="http://www.eclipse.org/modeling/emf/"&gt;EMF&lt;/a&gt; ecore model with the &lt;a href="http://eclipse.org/modeling/emft/?project=ecoretools"&gt;Ecore Tools&lt;/a&gt; diagram editor&lt;/li&gt;
&lt;li&gt;open the same ecore model with the Generic EMF Form Editor&lt;/li&gt;
&lt;li&gt;create instances of a model without the need to generate code and without starting a new runtime instance, using the "Create Dynamic Instance" feature (and the generic EMF editor again)&lt;/li&gt;
&lt;li&gt;generate a text editor and a model without a single line of Java code with &lt;a href="http://www.eclipse.org/Xtext/"&gt;Xtext&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;generate a tree based editor and a Java based model implementation with EMF&lt;/li&gt;
&lt;li&gt;create a UML diagram with the &lt;a href="http://www.eclipse.org/modeling/mdt/?project=uml2tools"&gt;UML Tools&lt;/a&gt; diagram editor&lt;/li&gt;
&lt;li&gt;query your models with OCL from the &lt;a href="http://www.eclipse.org/modeling/mdt/?project=ocl"&gt;OCL project&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
We didn't bothered about how to store our models or model intances (it's all XMI), we were using OMG standards like UML (the EMF based implementation is provided by the &lt;a href="http://www.eclipse.org/modeling/mdt/?project=uml2"&gt;UML2&lt;/a&gt; project, EMF's ecore is an EMOF-like model, we were using OCL, other implementations are available, too (e.g., &lt;a href="http://www.eclipse.org/modeling/mdt/?project=bpmn2"&gt;BPMN2&lt;/a&gt;, &lt;a href="http://www.eclipse.org/modeling/mdt/?project=sbvr"&gt;SBVR&lt;/a&gt;, or SPEM used by &lt;a href="http://www.eclipse.org/epf/"&gt;EPF&lt;/a&gt;). And if you do not find an Eclipse project, you probably will find a third party project providing an EMF based implementation ;-)

With tools like &lt;a href="http://www.eclipse.org/gef/"&gt;GEF&lt;/a&gt; or &lt;a href="http://www.eclipse.org/modeling/gmf/"&gt;GMF&lt;/a&gt; you can create (or generate) diagram editors for your models, and (well, I couldn't resist) with &lt;a href="http://www.eclipse.org/gef3d/"&gt;GEF3D&lt;/a&gt; you can even create 3D diagram editors, e.g. for visualizing inter-model connections. And there are many more tools out there, partially for simplifying the use of existing tools, for model transformations and code generation and so on. And of course you can adapt and modify the code generated above to suit your need. 
&lt;!-- ********************************************************************* --&gt;
&lt;h3&gt;Warning: Thin Ice!&lt;/h3&gt;
 While it is very easy to do impressive things (with the help of a tutorial), it is very hard to get into all these frameworks and tools. There are a lot of traps hidden everywhere! Just two examples from the tutorial:&lt;ul&gt;
&lt;li&gt;In the Xtext grammar we used here, the ecore model was imported (see Fig. 6). I tried the very same using the UML2 model, and I got a weird error when generating the code (actually I couldn't generate in that case).&lt;/li&gt;
&lt;li&gt;A NullPointer-Exception is thrown (you can see that in the console of the original Eclipse instance) when opening the &lt;code&gt;project.tasks&lt;/code&gt; file with the Generic EMF Form Editor. Fortunately it still is possible to select an element (for the OCL query), but it's a little bit weird.&lt;/li&gt;
&lt;/ul&gt;
Well, I probably should file a bug report at least for the first problem... So be warned: Even if the tutorial gives you the impression as if modelling with Eclipse tools is  very easy, it sometimes isn't.

In general, modifying generated code as well as using tools like GMF is not that simple. But at least there are the newgroups, tutorials, and even books (e.g. the &lt;a href="http://www.informit.com/store/product.aspx?isbn=9780321331885"&gt;EMF book&lt;/a&gt; (2nd edition!) or the &lt;a href="http://www.informit.com/store/product.aspx?isbn=0321534077"&gt;GMF book&lt;/a&gt;).
&lt;!-- ************************************************************************************************************* --&gt;
&lt;h3&gt;Disclaimer&lt;/h3&gt;
This is a &lt;b&gt;quick&lt;/b&gt; and &lt;b&gt;dirty&lt;/b&gt; tutorial article. I simply documented an example modelling session by taking some screenshots, and then wrote some explanations. So, there probably are some things I've missed to tell you or errors in my text. Please leave me a comment if you find a bug here ;-) (or if you like the tutorial). May the Model be with you!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-6242015161933265913?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/6242015161933265913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=6242015161933265913' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6242015161933265913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6242015161933265913'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2010/01/quickn-dirty-tutorial-on-modelling-with.html' title='Quick&apos;n Dirty Tutorial on Modelling with Eclipse'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_xki1C_H6jyM/S1W_k0Jrz0I/AAAAAAAAAD4/CQ_M0ujJo38/s72-c/qdmodelling_01.png' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-55375799540104657</id><published>2009-11-24T15:28:00.015+01:00</published><updated>2009-11-25T14:17:49.543+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Events'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><title type='text'>Retrospect: DemoCamp in Berlin</title><content type='html'>Yesterday I attended the &lt;a href="http://wiki.eclipse.org/Eclipse_DemoCamps_November_2009/Berlin"&gt;Eclipse DemoCamp in Berlin&lt;/a&gt;. It took place at &lt;a href="http://www.fokus.fraunhofer.de/de/fokus/index.html"&gt;Fraunhofer Fokus&lt;/a&gt;, and (as the last democamps) it was organized by Tom Ritter (thank you, Tom!). This time, there were ten (10!) presentations, seems as if we should organize a DemoDay next time. 

The camp started with a nice welcome talk by Ralph Müller, encouraging the audience to become Eclipse members (I will talk with my employer about that, promised ;-) ) and visit Eclipse Summit Europe (I won't miss it).

Kristian Duske (committer on the &lt;a href="http://eclipse.org/gef3d"&gt;GEF3D&lt;/a&gt; project) presented a "GEF3D Based Editor for the GMF Mapping Model", which was the subject of his diploma thesis. His editor enables the creation and editing of the GMF mapping model using simple drag-and-drop mouse operations. In contrast to the tree-based GMF editors, all involved models are visualized in a graphical manner, and since all models are visualized in a single 3D scene, inter-model-connections are visible, too. I really like the idea and his presentation, but since I was his tutor, I'm not really an impartial observer ;-)

&lt;div style="text-align:center"&gt;&lt;a href="http://3.bp.blogspot.com/_xki1C_H6jyM/SwvyI-lCu7I/AAAAAAAAADA/9Gl0EoJQMPo/s1600/gmfmapping3D.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 122px;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/SwvyI-lCu7I/AAAAAAAAADA/9Gl0EoJQMPo/s200/gmfmapping3D.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5407682013639654322" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Fig 1: Kristian's 3D GMF Mapping Editor&lt;/span&gt;&lt;/div&gt;

Martin Esser then demonstrated a small editor he has created with GMF (unfortunately without Kristian's 3D editor ;-) ) for variability models (aka &lt;a href="http://en.wikipedia.org/wiki/Feature_model"&gt;feature diagrams&lt;/a&gt;). The challenge is to implement these arcs connecting edges of optional or alternative features. I usually draw these diagrams using OmniGraffle, and although there is a &lt;a href="http://graffletopia.com/stencils/448"&gt;stencil&lt;/a&gt; for these diagrams available, it is painful to adjust these arcs --  a GMF based editor would be a great help. Maybe &lt;a href="http://www.sei.cmu.edu/library/abstracts/reports/90tr021.cfm"&gt;Kang et al&lt;/a&gt; designed these diagrams in order to test the abilities of programmers of graphical editors... (BTW, I just stumbled over &lt;a href="http://www.eclipse.org/proposals/feature-model/"&gt;this Eclipse project proposal&lt;/a&gt;, they want to provide a graphical editor as well)


It seems as if there is an &lt;a href="http://www.eclipse.org/Xtext/"&gt;Xtext&lt;/a&gt; presentation at every democamp ;-), and of course there was a talk about it in Berlin, too. Peter Friese gave a short overview of this really nice tool for creating editors (and more) for textual DSLs. I have attend a couple of Xtext presentations (e.g. at ESE 2008 and 2009), and although all these presentations used different slides and were presented by different persons, the slides are always magnificent (with great photos and nicely illustrated). Maybe they have an Xtext based tool for generating these slides... hmm... Ralph Müller mentioned something about Ytext in his keynote, maybe this is a new tool for generating presentations?

After a short break (with Eclipse sponsored sandwiches and soft drinks ;-)), Marcus Engelhardt demonstrated a tool called &lt;a href="http://www.modelbus.org/modelbus/index.php/metrino"&gt;Metrino&lt;/a&gt; for measuring models. Metrics can be defined using OCL for UML or Ecore based DSLs, and the tool creates nice reports and radar charts. IMHO model metrics are an important tool for modelers, and I always have the plan to create tool with GEF3D in order to display the metrics on top of the diagrams (using the city metaphor) as illustrated in Figure 2... Marcus, if you'd like to combine that with Metrino, I would be happy to assist you!

&lt;div style="text-align:center"&gt;&lt;a href="http://3.bp.blogspot.com/_xki1C_H6jyM/SwvwbTcM3QI/AAAAAAAAAC4/2FMn94ql92w/s1600/metricsample.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;width: 200px; height: 151px;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/SwvwbTcM3QI/AAAAAAAAAC4/2FMn94ql92w/s200/metricsample.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5407680129454103810" /&gt;&lt;/a&gt;&lt;span style="font-weight:bold;font-size:small"&gt;Fig. 2: Visualization of metrics with GEF3D
&lt;/span&gt;&lt;/div&gt;

Joachim Hänsel and Jaroslav Svacina introduced their tool &lt;a href="http://evotest.iti.upv.es/"&gt;EvoTest&lt;/a&gt; for creating tests automatically with evolutionary techniques. I know that tests are very important, but (shame on me) I'm neither an expert for  testing nor for evolutionary techniques. However, their tool looks very interesting, and I was impressed by the ability of that tool to generate white box tests considering path coverage.

Next, Martin Köster talked (&lt;a href="http://www.slideshare.net/matthiaskoester/architektur-einer-eclipse-dltk-ide-fr-clojure"&gt;slides are available here&lt;/a&gt;) about how he created an &lt;a href="http://kenai.com/projects/clojure-ide"&gt;Eclipse based IDE&lt;/a&gt; for the &lt;a href="http://clojure.org/"&gt;Clojure&lt;/a&gt; language, a Lisp (that language driving you crazy with brakets) dialect for the JVM. It was very interesting to learn how he used the &lt;a href="http://eclipse.org/dltk/"&gt;DLTK&lt;/a&gt; in combination with his own &lt;a href="http://antlr.org/"&gt;ANTLR&lt;/a&gt; parser. There seem to be a lot of issues addressed by Xtext and DLTK. I wonder if it would make sense to integrate these two tools.

Stephan Herrmann then presented a new episode of the famous &lt;a href="http://www.objectteams.org/"&gt;Object Teams&lt;/a&gt; series. After a short "previously on OT" flash back (summarizing OT as a great tool for reusing existing components in a flexible (via AOP techniques) yet controlled (via modules and a role-team-concept) manner), the story continued with a special and important problem: persistence. He explained how it is possible to use OT in combination with O/R-mappers -- with minimal effort by using OT techniques. Actually, this topic was subject of a &lt;a href="http://www.objectteams.org/publications/Diplom_Olaf_Otto.pdf"&gt;diploma thesis (in german language)&lt;/a&gt; by Olaf Otto. OT is a &lt;a href="http://eclipse.org/proposals/object-teams/index.php"&gt;proposed Eclipse project&lt;/a&gt;, and I hope it will become a real Eclipse project, soon.

Igor Novakovic demonstrated a powerful tool called &lt;a href="http://www.eclipse.org/smila/"&gt;SMILA&lt;/a&gt;. It is an Eclipse project for setting up tool chains for querying, processing and extracting data.  In his demo, he showed how to combine some cool Fraunhofer tools for image recognition with a search engine (Lucene) (probably other tools were involved as well). The nice thing about SMILA is that in the end all these tools are combined in a way that some data can be queried in a very simple manner (e.g. HTML formular). In the demo, some chemical structures could be searched in a collection of research papers. Simply querying the text content wouldn't be that thrilling, but in that case, a tool analyzed the figures in the papers and presented the molecules using &lt;a href="http://jmol.sourceforge.net/"&gt;Jmol&lt;/a&gt;. Some years ago I integrated a search engine (Verity Information Server) with a CMS based on StoryServer, and a tool like SMILA would have been a great help (I assume that with SMILA I would have spent days instead of months to accomplish that task...).

Finally,  Enrico Schnepel presented a small framework called &lt;a href="http://emf-observables.randomice.net/"&gt;emf.observables&lt;/a&gt; for simplifying EMF databinding. His cool (&lt;a href="http://prezi.com/"&gt;Prezi&lt;/a&gt; based) slides are available, too. Actually it is a small yet helpful tool, generating some plugins next to your EMF model implementation with some wrapper classes hiding the complexity of EMFObservables/IObservable.

It was a really interesting and inspiring evening: A big thank you to all the presenters. See you all again at the next Berlin Eclipse DemoCamp (or Day ;-)).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-55375799540104657?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/55375799540104657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=55375799540104657' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/55375799540104657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/55375799540104657'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/11/yesterday-i-attended-eclipse-democamp.html' title='Retrospect: DemoCamp in Berlin'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xki1C_H6jyM/SwvyI-lCu7I/AAAAAAAAADA/9Gl0EoJQMPo/s72-c/gmfmapping3D.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-5259309813555032751</id><published>2009-09-30T11:35:00.008+02:00</published><updated>2009-09-30T15:19:58.413+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>String.format vs. MessageFormat.format vs. String.+ vs. StringBuilder.append</title><content type='html'>Usually I'm not a performance hacker, i.e. I seldom use the final keyword, and I  dare to use &lt;code&gt;List.size()&lt;/code&gt; in loop expressions. But I'm a little bit sensitive when it comes to string operations, as they can cause severe performance problems, and sometimes security issues as well, e.g., if an SQL query is to be created (ok, bad example, one can use &lt;code&gt;PerparedStatement&lt;/code&gt; instead of hacking an SQL string).

For logging I often have to concatenate strings, such as 
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;
if (log.isLoggable(Level.INFO)) {
    log.info("Command created - cmd=" + cmd); //$NON-NLS-1$
}
&lt;/pre&gt;
Actually I'm not writing lines like this myself, I let &lt;a href="http://log4e.jayefem.de/"&gt;log4e&lt;/a&gt; do the job -- I really love that tool! 

But sometimes these string concatenations are hard to read, using a &lt;code&gt;String.format&lt;/code&gt; or &lt;code&gt;MessageFormat.format&lt;/code&gt; would make it much easier. Here are some examples:
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;
foo(String.format("Iteration %d, result '%s'", i, value[i%2]));

foo(MessageFormat.format("Iteration {0}, result ''{1}''", i, value[i%2]));

// single line:
foo( "Iteration " + i + ", result '" + value[i%2] + "'");

// multi line:
String s;
s = "Iteration ";
foo(s); s+= i; foo(s); s+= ",\nresult '";
foo(s); s+= largeString(i); foo(s); s+= "', '"; 
foo(s); s+= largeString(i+1); foo(s); s+= "'";

foo(new StringBuilder("Iteration '")
    .append(i).append(", result '").append(value[i%2]).append("'")
    .toString());
&lt;/pre&gt;
(Update: the multi line test was added after daObi and Laurent commented the first version)

Hmm... maybe the "+" isn't that bad ;-)  I do not understand why &lt;code&gt;String.format&lt;/code&gt; and&lt;code&gt;MessageFormat.format&lt;/code&gt; have these different notations, and frankly I seldom get the format string right in the first run. So, besides the aesthetics, what about performance. What would you guess? My guess was &lt;code&gt;StringBuilder&lt;/code&gt; would be the fastest, followed by the format methods, and the String operator "+" would be the slowest as new Strings are to be created all along. I run a little test (calling these methods 100000 times, &lt;code&gt;foo()&lt;/code&gt; is doing nothing and was, besides other things, only added in order to avoid too much compiler optimizations, although I have no idea if that worked ;-) ). Note that in the test only a few strings are concatenated, but I think that's a typical example and it was the setting I was thinking about to use format methods instead of string concatenation (and it's  quite similar to many toString methods). I was surprised by the result:&lt;table border="1"&gt;
&lt;tr&gt;&lt;td&gt;String.format:&lt;/td&gt;&lt;td&gt;757 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;MessageFormat.format:&lt;/td&gt;&lt;td&gt;1078 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;String +:&lt;/td&gt;&lt;td&gt;61 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;String + (multi line):&lt;/td&gt;&lt;td&gt;162 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;StringBuilder:&lt;/td&gt;&lt;td&gt;74 ms&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
Gosh! The "+" operator clearly is the winner! It is 10 (ten!) times faster then the format methods. 10 times, can you believe that. I was really surprised, and frankly, I couldn't believe it. (Update: daObi and Laurent explain it, see their comments below). Thus I changed the test, assuming the compiler tricked me, but I always got more or less the same results. I figured it may be the size of the strings, so I also changed that. That is, I used large strings (with 70.000 characters, the method returns one of two strings in order to avoid compiler optimization) in the concatenation:
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;
for (int i = 0; i &lt; n; i++) {
    s = MessageFormat.format("Iteration {0,number,#},\nresult ''{1}'', ''{2}''", i,
   largeString(i), largeString(i+1));
}

for (int i = 0; i &lt; n; i++) {
 s =  "Iteration " + i + ",\nresult '" + largeString(i) + "', '" + largeString(i+1) + "'";
}
&lt;/pre&gt;
Actually, the test is a little bit unfair, as in all cases at least the result string has to be created (i.e. also the format methods have to create strings), but at least the string is rather long. The result string s has a length of 140027 characters, so this is a pretty long string, isnt't? Here are the result of the long-string-test:&lt;table border="1"&gt;
&lt;tr&gt;&lt;td&gt;String.format:&lt;/td&gt;&lt;td&gt;584 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;MessageFormat.format:&lt;/td&gt;&lt;td&gt;816 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;String +:&lt;/td&gt;&lt;td&gt;621 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;String + (multi line):&lt;/td&gt;&lt;td&gt;867 ms&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;StringBuilder:&lt;/td&gt;&lt;td&gt;555 ms&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
Yeah! Now we have the order I expected in the first place: &lt;code&gt;StringBuffer.append&lt;/code&gt; is the winner, followed by &lt;code&gt;String.format&lt;/code&gt;. &lt;code&gt;MessageFormat.format&lt;/code&gt; has a little problem and is even slower than the String concatenation. But compared to the result of the first test, all methods are at the same speed.

So, what did I learn? First, I will use the plain and simple string concatenation in the future more often, as it is easier to write in many cases compared to some weird format strings. I will use &lt;code&gt;String.format&lt;/code&gt; only if I probably need to translate my code, since this is easier to translate a format string than changing the code (if the order of the sentence components change in another language). And, of course, I will use &lt;code&gt;StringBuilder&lt;/code&gt; if large strings have to be concatenated, but I think I use it less in toString-methods. And maybe I'm going to read a book about performance hacking -- do you have any recommendations? Anyway, this test also teaches me (again) that good performance is not (only) a question of single statements, but a question of good algorithms and good design in general.

Note: Actually this is not the first time I was surprised by the result of a preformance test. I did a test once comparing the performance of different class library designs in case of a math library for matrices and vectors. I have documented the test in the &lt;a href="http://lwjgl.org/forum/index.php/topic,2456.0.html"&gt;LWJGL forum&lt;/a&gt;, and its results influenced the design of the GEF3D geometry package (see &lt;a href="https://dev.eclipse.org/svnroot/technology/org.eclipse.gef3d/trunk/org.eclipse.draw3d.geometry/src/java/org/eclipse/draw3d/geometry/package-info.java"&gt;package documentation&lt;/a&gt;).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-5259309813555032751?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/5259309813555032751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=5259309813555032751' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/5259309813555032751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/5259309813555032751'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/09/stringformat-vs-messageformatformat-vs.html' title='String.format vs. MessageFormat.format vs. String.+ vs. StringBuilder.append'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-6355060200754129698</id><published>2009-07-01T20:20:00.004+02:00</published><updated>2009-07-01T20:31:13.830+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EMF'/><category scheme='http://www.blogger.com/atom/ns#' term='Xtext'/><title type='text'>User Report: Migrate from oAW Xtext to TMF Xtext</title><content type='html'>With Eclipse 3.5 comes the new version of Xtext, called TMF Xtext. Since I had to switch to Eclipse 3.5 in order to keep GEF3D running on the latest Eclipse version, I decided to migrate from the old openArchitecture Xtext (oAW Xtext) to the new TMF version.

Fortunately the Xtext documentation contains a section about migrating from oAW Xtext to TMF Xtext. Frankly, I was a little bit afraid (never change a running system). But at least I hadn't implemented any content assist or other editor extensions yet, so I hoped that it wouldn't be too hard.

Before you read on, please note that I'm only an Xtext &lt;i&gt;user&lt;/i&gt;. I don't know any internal details about Xtext. Maybe some of my problems can be solved more efficiently, if that is the case, I would be more then happy if you leave me a comment. My first intention was to migrate my already running grammar as fast as possible, with as few modifications as possible.

&lt;h2&gt;The Setting&lt;/h2&gt;
I have written a model transformation language, and it consists of an Xtext grammar (with about 90 rules), an interpreter for executing the language, and other things which I didn't expected to be involved in the migration, as a debugger component or other user-interface stuff. An Xtend-based M2M transformation exists which modifies the generated ecore model in order to set some default values, add some workarounds for existing oAW bugs, and do other things. In order to migrate my application, I had to
&lt;ol&gt; &lt;li&gt;migrate the grammar&lt;/li&gt; &lt;li&gt;adapt the M2M-transformation&lt;/li&gt;  &lt;li&gt;adapt client code which uses the model and the Xtext API&lt;/li&gt;&lt;/ol&gt;
In the following old versions are highlighted with a light red back and the new ones with a light green background.

&lt;h2&gt;Migrating the Grammar&lt;/h2&gt;
As described in the Xtext documentation, I had to replace "Enum" with "enum", and add two new lines at the beginning of the grammar.

Since "with" has become a keyword. Thus I had to rename "with" in my grammar :
&lt;pre style="background-color:#ffeeee"&gt;&lt;code&gt;RuleXY: ... ( "with" with=Block)? ...&lt;/code&gt;&lt;/pre&gt;
into
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;RuleXY: ... ( "with" &lt;b&gt;_&lt;/b&gt;with=Block)? ...&lt;/code&gt;&lt;/pre&gt;
This also caused some small changes in the model and the client code. Is there a way to use Xtext keywords as a reference names?

&lt;h3&gt;Backtracking&lt;/h3&gt;
Apparently the parser generation (or some settings) has changed, too. E.g., the following rule worked with the oAW Xtext version:
&lt;pre style="background-color:#ffeeee"&gt;&lt;code&gt;ParameterReference: QualifiedParameterReference|SimpleParameterReference;
SimpleParameterReference: type=Type (name=ID)?;  
QualifiedParameterReference: type=Type name=ID;&lt;/code&gt;&lt;/pre&gt;
The idea of these rules is to force the definition of a name in case of qualified parameter references and to make it optional in simple ones.
Unfortunately these rules are not working with the new version. Since ANTLR is a LL-parser, there are some constraints on how to define the grammar. There is a &lt;a href="http://www.antlr.org/wiki/display/ANTLR3/How+to+remove+global+backtracking+from+your+grammar"&gt;document&lt;/a&gt; explaining how to remove backtracking from a grammar, unfortunately some of the described techniques cannot be used with Xtext. In some cases I was able to fix the problem by rewriting my grammar, as in this example: I simply had to reorder the first rule:
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;ParameterReference: SimpleParameterReference|QualifiedParameterReference;
SimpleParameterReference: type=Type (name=ID)?;  
QualifiedParameterReference: type=Type name=ID;&lt;/code&gt;&lt;/pre&gt;
In some cases I couldn't find a solution (maybe it is possible, but I'm not an LL/LR-expert). Actually I'm not the first one with this problem, and there is a posting in the TMF newsgroup about this. If you cannot rewrite your grammar, you need backtracking (and lookahead). &lt;a href="http://dev.eclipse.org/newslists/news.eclipse.modeling.tmf/msg01108.html"&gt;Thanks to this posting&lt;/a&gt;, I was able to fix the problem. I had to edit the MWE-file from
&lt;pre style="background-color:#eeeeff"&gt;&lt;code&gt;&amp;lt;fragment class="org.eclipse.xtext.generator.AntlrDelegatingFragment" /&gt;&lt;/code&gt;&lt;/pre&gt;
to
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;&amp;lt;fragment class="de.itemis.xtext.antlr.XtextAntlrGeneratorFragment"&gt;
   &amp;lt;options k="2" backtrack="true" memoize="true"/&gt;
&amp;lt;/fragment&gt;&lt;/code&gt;&lt;/pre&gt;
Note that you have to install the itemis generator fragment from &lt;a href="http://download.itemis.com/updates"&gt;http://download.itemis.com/updates&lt;/a&gt; as described in the Xtext documentation (page 62).
Maybe I'm going to "left factor" my grammar in a future version, but for now I only wanted to get my application running.

&lt;h3&gt;Lexer Rules&lt;/h3&gt;
In the oAW version, lexer rules were defined with the keyword "native", which has been changed to "terminal". Not mentioned in the migration guide yet: INT was redefined in the new version. I had rewritten the definition in the old version in order to remove the optional sign (as my language is handling this itself). This is the old INT definition:
&lt;pre style="background-color:#ffeeee"&gt;&lt;code&gt;Native INT: ('-')?('0'..'9')+ &lt;/code&gt;&lt;/pre&gt;
And here's the new one:
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;terminal INT: ('0'..'9')+ &lt;/code&gt;&lt;/pre&gt;
In my case I could remove my own definition since the new one matches my requirements. In other cases, this might be a trap.

According to the documentation, it should be possible to define the type of a terminal rule now. I tried this as follows:
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;terminal FLOAT returns ecore::EFloat: ('0'..'9')*'.'('0'..'9')+;&lt;/code&gt;&lt;/pre&gt;
As a matter of fact, the code is generated as expected, but the parser still returns a String, which leads to a ClassCastException. So I removed the type definition and added a convenient method to my model, as described below. I assume this is a bug or something, I will file a report later on ;-). Since the old version always returned Strings, my code was prepared for that, anyway.

&lt;h3&gt;OrmPackage missing&lt;/h3&gt;
I don't know exactly why or when, but at some point in time my grammar file contains got an error marker:
&lt;pre&gt;&lt;code&gt;- WrappedException: java.lang.ClassNotFoundException: com.sun.java.xml.ns.persistence.orm.OrmPackage"&lt;/code&gt;&lt;/pre&gt;
This &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281664"&gt;bug seems to be fixed already&lt;/a&gt;, fortunately it is possible to generate the model and code from the grammar, even with this error.

&lt;h3&gt;Unassigned Actions&lt;/h3&gt;
In the oAW Xtext version, a model element was assigned whenever a non-abstract rule was hit. My grammar contained the following rule:
&lt;pre style="background-color:#ffeeee"&gt;&lt;code&gt;NullLiteral: "null";&lt;/code&gt;&lt;/pre&gt;
This rule is not working with the new TMF Xtext version. As found in the documentation "by default the object to be returned by a parser rule is created lazily on the first assignment". Although I've read that passage, I was not aware of the consequences. In the new version, an element is not automatically created when the rule is hit, but only when an assignment is to be executed. That is, a rule which contains only terminals does not create a model element, as in the example above. While this first example is obvious, the problem is sometimes hidden. Here is another more tricky example:
&lt;pre style="background-color:#ffeeee"&gt;&lt;code&gt;Block: "{" (statements+=BlockStatement)* "}";&lt;/code&gt;&lt;/pre&gt;
If no "BlockStatements" are specified, that is in case of an empty block ("{}"), no block element is created at all. I posted that problem to the newsgroup, and Sebastian Zarnekow immediately &lt;a href="http://www.eclipse.org/newsportal/article.php?id=1189&amp;amp;group=eclipse.modeling.tmf#1189"&gt;solved&lt;/a&gt; my problem (Thank you very much, Sebastian!).
The solution is to use &lt;i&gt;unassigned actions&lt;/i&gt;, which forces the creation of an element of the specified type. So I had to change the rules above as follows:
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;NullLiteral: {NullLiteral} "null";
Block: {Block} "{" (statements+=BlockStatement)* "}";&lt;/code&gt;&lt;/pre&gt;
I figure this is a bitchy trap, especially if there is an optional assignment.

&lt;h2&gt;Model Changes&lt;/h2&gt;
I'm already using an Xtend M2M-transformation to adjust the generated ecore model. TMF Xtext supports this mechanism, I simply had to rename my Xtend extension into MitraPostProcessor.ext (Mitra is the name of my language, by the way).

&lt;h3&gt;Enumeration NULL values&lt;/h3&gt;
There are some adjustments necessary due to changed behaviour of Xtext. Most notable: There is no "NULL" value generated for enumerations. Also, it is not possible to define a hidden enumeration in the grammar, which might could have solved that problem. IMHO, this is a major drawback, as this makes a postprocessing of the created ecore file necessary.

But they can be added to the M2M transformation. Unfortunately, I didn't got this problem solved with Xtend, I posted that to the &lt;a href="http://www.eclipse.org/newsportal/article.php?id=1174&amp;amp;group=eclipse.modeling.tmf#1174"&gt;TMF newsgroup&lt;/a&gt;. This is at least one solution using Java, although I would prefer a pure Xtend solution:
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;process(ecore::EPackage p):
 addNullValue(p, "VisibilityModifier") -&gt;
 ... ;

Void addNullValue(ecore::EPackage p, String toEnum):
 doAddNullValue( (ecore::EEnum) p.getEClassifier(toEnum) );
 
Void doAddNullValue(ecore::EEnum e):
 JAVA de.feu.MitraPostProcessorHelper.addNullValue(org.eclipse.emf.ecore.EEnum);&lt;/code&gt;&lt;/pre&gt;

And this is the Java extension:

&lt;pre style="background-color:#eeffee" name="code" class="Java:nocontrols:nogutter"&gt;public class MitraPostProcessorHelper {

 public static void addNullValue(org.eclipse.emf.ecore.EEnum e) {
  for (EEnumLiteral literal : e.getELiterals()) {
   literal.setValue(literal.getValue() + 1);
  }
  EEnumLiteral nullLiteral = EcoreFactory.eINSTANCE.createEEnumLiteral();
  nullLiteral.setName("NULL");
  nullLiteral.setLiteral("NULL");
  nullLiteral.setValue(0);
  e.getELiterals().add(0, nullLiteral);
 }
}&lt;/pre&gt;
In order to make a literal the default value, it must be the &lt;i&gt;first&lt;/i&gt; defined literal. This is why &lt;code&gt;e.getELiterals().add(0, nullLiteral);&lt;/code&gt; is required, simply adding the literal with &lt;code&gt;e.getELiterals().add(nullLiteral);&lt;/code&gt; doesn't work.

&lt;h3&gt;Java Body Annotation in the Ecore Model&lt;/h3&gt;
In the old version, Xtext didn't create the genmodel and no code. I added this feature and I also edited the generated code after is was created using oAW extension. Since Xtext is doing the code generation now automatically, I didn't feel that comfortable with manually editing the generated model code anymore. So I decided to add Java annotations to the ecore model in order to add some tiny helper methods. This is how body annotations are added to an ecore model in Xtend:
&lt;div style="width:97%; height:200px; overflow:auto;"&gt;
&lt;pre style="background-color:#eeeeee"&gt;&lt;code&gt;Void addJavaBodies(ecore::EPackage p):
 let ecorePackage = p.getEcorePackage():
 p.getEClassifier("Bounds").addOperation("isMany",
     ecorePackage.getEClassifier("EBoolean"),
       'return upper==-1 || upper&gt;1;') -&gt;
   ...;
/*
This is a hack in order to retrieve the ecore package itself. This is usually
done with a Java extension, but I did not want to add a Java extension here.
The trick is to retrieve the package by navigating to the container of an ecore
type (here a String).
*/
cached ecore::EPackage getEcorePackage(ecore::EPackage p):
  (ecore::EPackage)
  ( ((ecore::EClass) (p.getEClassifier("MetamodelDeclaration")))
    .getEStructuralFeature("type").eType.eContainer
  );
 

create ecore::EOperation addOperation(ecore::EClassifier c, String strName, ecore::EClassifier type,  String strBody):
 setName(strName) -&gt;
 setEType(type) -&gt;
 eAnnotations.add(addBodyAnnotation(strBody)) -&gt;
 ((ecore::EClass)c).eOperations.add(this);


create ecore::EOperation addOperation(ecore::EClassifier c, String strName, ecore::EClassifier type, 
 List parameters,
 String strBody):
 setName(strName) -&gt;
 setEType(type) -&gt;
 parameters.collect(e|((List)e).setParameter(this)) -&gt;
 eAnnotations.add(addBodyAnnotation(strBody)) -&gt;
 ((ecore::EClass)c).eOperations.add(this);

create ecore::EParameter setParameter(List parameter, ecore::EOperation op):
 setName((String)parameter.get(0)) -&gt;
 setEType((ecore::EClassifier) parameter.get(1)) -&gt;
 op.eParameters.add(this)
;

create ecore::EAnnotation addBodyAnnotation(ecore::EOperation op, String strBody):
 setSource("http://www.eclipse.org/emf/2002/GenModel") -&gt;
 this.createBody(strBody) -&gt;
 op.eAnnotations.add(this);

create ecore::EStringToStringMapEntry createBody(ecore::EAnnotation anno, String strBody):
 setKey("body") -&gt;
 setValue(strBody) -&gt;
 anno.details.add(this);
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2&gt;API Changes&lt;/h2&gt;
So far I found three API changes which required changes in my code. These changes are rather simple and briefly explained in the following.

&lt;h3&gt;NodeUtil.getNode(..)&lt;/h3&gt;
First of all, &lt;code&gt;NodeUtil.getNode(EObject);&lt;/code&gt; has changed. There is no type &lt;code&gt;Node&lt;/code&gt; anymore. I had to change my code from
&lt;pre name="code" class="Java:nocontrols:nogutter" style="background-color:#ffeeee"&gt;Node node = NodeUtil.getNode(eobj);&lt;/pre&gt;
to
&lt;pre name="code" class="Java:nocontrols:nogutter" style="background-color:#eeffee"&gt;NodeAdapter adapter = NodeUtil.getNodeAdapter(eobj);
AbstractNode node = null;
if (adapter != null) {
 node = adapter.getParserNode();
}&lt;/pre&gt;

&lt;h3&gt;Resources and Setup&lt;/h3&gt;
For (JUnit) tests, I have to call a setup method in order to register Xtext's resource implementations and my model. This is now simply achieved via a generated setup method. This is the setup method I'm using now in JUnit tests:
&lt;pre style="background-color:#eeffee" name="code" class="Java:nocontrols:nogutter"&gt;public static void setup() {
   System.setProperty("org.eclipse.emf.ecore.EPackage.Registry.INSTANCE",
   "org.eclipse.emf.ecore.impl.EPackageRegistryImpl");
   MitraStandaloneSetup.doSetup();&lt;/pre&gt;

&lt;h3&gt;No DSL-specific Editor Class&lt;/h3&gt;
A little bit surprising at first is the absence of a DSL specific editor class, in my case &lt;code&gt;MitraEditor&lt;/code&gt;. Instead, the general Xtext editor class is used, DSL specifics are injected using Google Guice as described in the Xtext manual. Most surprising is the new syntax found in the plugin.xml which is used to inject things. Here is the declaration of my editor using the new notation (the plugin.xml is generated):
&lt;pre style="background-color:#eeffee"&gt;&lt;code&gt;&amp;lt;extension point="org.eclipse.ui.editors"&gt;
   &amp;lt;editor
       class="de.feu.MitraExecutableExtensionFactory:org.eclipse.xtext.ui.core.editor.XtextEditor"
       contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
       default="true"
       extensions="mitra"
       id="de.feu.Mitra"
       name="Mitra Editor"&gt;
   &amp;lt;/editor&gt;
&amp;lt;/extension&gt;
&lt;/code&gt;&lt;/pre&gt;
The attribute "class" defines the Guice module to be created and the editor class. Unfortunately I need the editor class in order to add breakpoint markers (for my debugger plugin). The old version looks like this:
&lt;pre style="background-color:#ffeeee" name="code" class="Java:nocontrols:nogutter"&gt;public class MitraBreakpointAdapterFactory implements IAdapterFactory {
 public Object getAdapter(Object adaptableObject, Class adapterType) {
  if (adaptableObject instanceof MitraEditor) {
    ...
&lt;/pre&gt;
How do I identify the mitra editor in the new version? First of all, instead of a generated DSL specific editor, an &lt;code&gt;XtextEditor&lt;/code&gt; is used (this class is found in plugin &lt;code&gt;org.eclipse.xtext.ui.core&lt;/code&gt;). Then the current language can be retrieved via &lt;code&gt;getLanguageName()&lt;/code&gt;. This is the new version:
&lt;pre style="background-color:#eeffee" name="code" class="Java:nocontrols:nogutter"&gt;public Object getAdapter(Object adaptableObject, Class adapterType) {
 if (adaptableObject instanceof XtextEditor) {
  XtextEditor xtextEditor = (XtextEditor) adaptableObject;
  if ("de.feu.Mitra".equals(xtextEditor.getLanguageName())) {
  ...&lt;/pre&gt;
Note that the name of the editor class has to be changed in the plugin.xml of the debug plugin accordingly.

&lt;h2&gt;Summary&lt;/h2&gt;
After applying the changes described above, my language worked as expected (at least all the tests are green and my application is running). Since I haven't written any extensions for content assist or other UI things, I only had to adjust the grammar, my M2M-transformation and the code a little bit. If you do not have an M2M-transformation, you may have to add it in order to add the missing NULL values for enumerations -- I assume this is the case quite often.

TMF Xtext adds some very nice features (grammar mixings, improved linking/cross references feature with ILinkingService, serialization with formatter, return types,  and tree rewrite actions). These features will simplify my hand written code immensely, and I'm looking forward using them. Last but not least, since Xtext is now part of the Eclipse modeling package, it is much easier to install an Xtext based DSL and editor.

Last but not least: Kudos to the Xtext team! The new version looks really nice! And many thanks for the great and fast (newsgroup) support!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-6355060200754129698?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/6355060200754129698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=6355060200754129698' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6355060200754129698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/6355060200754129698'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/07/user-report-migrate-from-oaw-xtext-to.html' title='User Report: Migrate from oAW Xtext to TMF Xtext'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-5659784376857460183</id><published>2009-04-17T11:58:00.010+02:00</published><updated>2009-04-17T13:30:29.084+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MDD'/><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>First Steps Towards a Multi Editor 3D</title><content type='html'>Some days ago I &lt;a href="http://jevopisdeveloperblog.blogspot.com/2009/04/you-will-be-3d-fied-resistance-is.html"&gt;3d-fied the UML 2 Tools Diagram Editors&lt;/a&gt;. Well, a single 2D editor in 3D is funny but not really thrilling. You may ask: "Why should I use a 2D editor in 3D?" And I agree with you. The idea behind GEF3D is to enable multi model or multi diagram editing (this is why I started the GEF3D project). I strongly believe that "raising the level of abstraction" as promoted by all these model-driven approaches requires  good tools. What does "good" mean in that context? Many models are edited graphically&lt;sup&gt;&lt;a href="#foot1"&gt;*&lt;/a&gt;&lt;/sup&gt;, and using different levels of abstraction means using different models, that is diagrams. Also, using different (architectural) view points means using different models or diagrams. And all these models are somehow related! But these relationships usually aren't visualized. Too often, the best thing you get is a (EMF generated) tree editor. The GMF mapping editor is a typical example. IMHO a good tool would be a tool enabling graphical notations throughout the development process. And this is what GEF3D is all about.

By 3d-fying existing GEF or GMF based editors, it is possible to reuse existing code and, from the user's perspective, existing and well-known graphical notations. This is also a principle of GEF3D: Enable exiting editors to be reused in 3D. Nobody wants to write new 3D-enabled editors when there are 2D editors already available, and no user wants to learn a new 3D-like notion of the UML. 

The next step is to open several 2D diagrams  in a single 3D scene. Actually this is working for quite some time, an example application is published in [&lt;a href="#Pilgrim08b"&gt;1&lt;/a&gt;]. This application was more a design study or proof of concept, I 3d-fied an elder version of the TOPCASED UML editor (which is GEF based). With the 3d-fied UML2 Tools editors, I was optimistic to create a UML Tools multi editor as well. Frankly, I was very much surprised how easy that was! The example code is part of the UML2 tools example found in the GEF3D SVN. 
I created a video demonstrating the multi editor. Have fun! (Sorry for the bad quality, it's my first video I uploaded to YouTube)
&lt;span&gt;
&lt;object width="640" height="505"&gt;&lt;param name="movie" value="http://www.youtube.com/v/fD5QLuPo-uE&amp;hl=en&amp;fs=1&amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/fD5QLuPo-uE&amp;hl=en&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;a href="http://www.youtube.com/watch?v=fD5QLuPo-uE"&gt;Watch the video at YouTube&lt;/a&gt;
&lt;/span&gt;

A multi editor certainly is only the foundation for real-world (MDD) applications. Opening multiple editors in a single 3D scene enables the visualization of inter-model (or inter-diagram) relations such as transformation traces [1], inter-package dependencies, model-differences, manual mappings and so on.

While the demo sounds promising, there are a lot of problems and &lt;a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_file_loc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_id=&amp;bugidtype=include&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;classification=Technology&amp;email1=&amp;email2=&amp;emailtype1=substring&amp;emailtype2=substring&amp;field-1-0-0=classification&amp;field-1-1-0=product&amp;field0-0-0=noop&amp;keywords=&amp;keywords_type=allwords&amp;long_desc=&amp;long_desc_type=allwordssubstr&amp;product=GEF3D&amp;query_format=advanced&amp;remaction=&amp;short_desc=&amp;short_desc_type=allwordssubstr&amp;status_whiteboard=&amp;status_whiteboard_type=allwordssubstr&amp;type-1-0-0=anyexact&amp;type-1-1-0=anyexact&amp;type0-0-0=noop&amp;value-1-0-0=Technology&amp;value-1-1-0=GEF3D&amp;value0-0-0=&amp;votes=&amp;order=bugs.bug_id%20desc&amp;query_based_on="&gt;known bugs&lt;/a&gt; I don't want to keep secret. There are some problems with feedback figures, text editing is not working as expected, there are problems with rotated planes (yes, actually the planes can be positioned every where in the 3D scene), currently it isn't possible to simply move an element from one diagram to another and so on. The example is only the first step, and we are working for solving the known issues.

&lt;dl class="bib"&gt;&lt;dt&gt;&lt;a name="Pilgrim08b"&gt;[1]&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;J. v. Pilgrim and B. Vanhooff and I. Schulz-Gerlach and Y. Berbers: Constructing and Visualizing Transformation Chains.     In:  ECMDA-FA 2008, Berlin, Germany, June 9-13, Proceedings, LNCS 5095,  pp 17--32,  Springer-Verlag,  2008. URL: &lt;a href="http://dx.doi.org/10.1007/978-3-540-69100-6_2"&gt;http://dx.doi.org/10.1007/978-3-540-69100-6_2&lt;/a&gt;&lt;/dd&gt;&lt;/dl&gt;


&lt;hr/&gt;
&lt;span style="font-size:small"&gt;
&lt;a name="foot1"&gt;*&lt;/a&gt;For non-graphical models, XText is a wonderful tool. Combining text and graphical models certainly is a challenge for future research ;-)
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-5659784376857460183?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/5659784376857460183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=5659784376857460183' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/5659784376857460183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/5659784376857460183'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/04/first-steps-towards-multi-editor-3d.html' title='First Steps Towards a Multi Editor 3D'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-7681656327666120836</id><published>2009-04-08T16:07:00.005+02:00</published><updated>2009-04-09T10:21:22.973+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>You will be 3d-fied. Resistance is futile.</title><content type='html'>I admit it: I like Startrek. This is why I called a special pattern used to adopt editors for using them in a 3D scene with &lt;a href="http://www.eclipse.org/gef3d/"&gt;GEF3D&lt;/a&gt; "Borg-Factory-Pattern" (a borg factory modifies an object after it has been created by a "normal" factory using assimilators). Kristian Duske recently "3d-fied" the &lt;a href="http://www.eclipse.org/modeling/emft/?project=ecoretools"&gt;Ecore Diagram Editor&lt;/a&gt;---but he did not use the borg factory. So, why didn't we need the borg technology to assimilate this editor to be used in a 3D scene? The Ecore Diagram Editor is based on &lt;a href="http://www.eclipse.org/gmf/"&gt;GMF&lt;/a&gt;. Frankly, I have lots of respect for GMF. I know &lt;a href="http://www.eclipse.org/gef/"&gt;GEF&lt;/a&gt; pretty well, but GMF with its thousands of new extension points, policies and stuff... it's like... like.. yeah, it's like a Borg cube. The good thing about that is that borg technology is already on board. We beamed Kristian on board of that cube, and he returned with a some nice providers enabling us to add 3D-behaviour to existing GMF editors. GEF3D needed some more examples anyway, so we 3d-fied the Ecore editor, and some of the UML editors of the &lt;a href="http://wiki.eclipse.org/MDT-UML2Tools"&gt;UML Tools&lt;/a&gt; (which are also GMF-based), viz. the class, activity, and use case editors. The best thing: We only had to write a bunch of classes. For example, the 3D UML class editor plugin consists of 8 classes with only 212 statements (measured by &lt;a href="http://freshmeat.net/projects/c_count/"&gt;c_count&lt;/a&gt;). 

The 3D versions of these editors are available from &lt;a href="http://dev.eclipse.org/svnroot/technology/org.eclipse.gef3d/trunk/"&gt;GEF3D's SVN&lt;/a&gt; repository (plugins org.eclipse.gefd.examples.uml and org.eclipse.gefd.examples.ecore). To give you an impression about what you need to 3d-fy an existing 3D GMF-based editor, here is a brief description on how we adopted the UML class editor (a tutorial about GEF3D is planned for June, since then don't hesitate to post your questions in the GEF3D newsgroup!):
&lt;ol&gt;
    &lt;li&gt;First, a new plugin is created, with a &lt;code&gt;UMLDiagram3DPlugin&lt;/code&gt; activator, which is not really needed.&lt;/li&gt;
    &lt;li&gt;A new editor class &lt;code&gt;UMLDiagramEditor3D&lt;/code&gt; subclasses the original &lt;code&gt;UMLDiagramEditor&lt;/code&gt;. Instead of a 2D viewer we have to instantiate a 3D viewer, actually, this need the most code since we have to copy and paste some code from the base classes.&lt;/li&gt;
    &lt;li&gt;Only one editpart and figure have to be exchanged, that is the pair for the diagram, here the package. We have to provide new 3D versions for these two classes (&lt;code&gt;PackageEditPart3D&lt;/code&gt;, &lt;code&gt;DiagramFigure3D&lt;/code&gt;).&lt;/li&gt;
    &lt;li&gt;The new edit part has to be created by a new factory &lt;code&gt;UMLEditPartFactory3D&lt;/code&gt;, which subclasses the original &lt;code&gt;UMLEditPartFactory&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;This factory has to be injected into the editor somehow. This is done using a GMF provider &lt;code&gt;UMLEditPartProvider3D&lt;/code&gt;. Since we only need this provider for our 3D editor, we have added a very dirty hack to identify which editor calls the provider. This is hack is really dirty (better not look at the provider ;-) ), and I hope to find a better solution.&lt;/li&gt;
    &lt;li&gt;Finally we have to exchange the policy which creates the 2D feedback handles and replace it with a 3D version. Again, this is done by a provider called &lt;code&gt;UMLEditPolicyProvider3D&lt;/code&gt;, the 3D policy is called &lt;code&gt;Handles3DEditPolicy&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
That's it. And what do you get for that? The result is an UML editor with the diagram projected on a plane in a 3D scene. You can use the camera to orbit and move around. Since it's derived from the original 2D UML editor, it is (more ore less) fully editable. Try to select classes and move them around, create new classes and so on. You can even open the very same UML model in the 3D editor and 2D editor simultaneously, changes are reflected in both editors automatically!
&lt;div&gt;
&lt;a href="http://lh6.ggpht.com/_xki1C_H6jyM/SdywlhtbCPI/AAAAAAAAABo/T2obwdwKPtU/umlt-activity.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;width: 400px; height: 196px;" src="http://4.bp.blogspot.com/_xki1C_H6jyM/SdywlhtbCPI/AAAAAAAAABo/T2obwdwKPtU/s400/umlt-activity.png" border="0" alt="The 3D version of the UML Tool's activity diagram editor. "id="BLOGGER_PHOTO_ID_5322323018395617522" /&gt;&lt;/a&gt;
&lt;span style="font-weight:bold;font-size:small"&gt;The 3D version of the UML Tool's activity diagram editor (on the right hand side, 2D version on the left). Note the 3D handles and the transparent feedback figure!&lt;/span&gt;
&lt;/div&gt;
Unfortunately there are some open issues which restrict the 3D editor: no edges can be drawn (sometimes, you can draw edges but don't see any feedback, sometimes the Eclipse IDE crashes when you try to do that). You cannot open more then one 3D editor at a time, we have a problem with the texture manager. And there are &lt;a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_file_loc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_id=&amp;bugidtype=include&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;classification=Technology&amp;email1=&amp;email2=&amp;emailtype1=substring&amp;emailtype2=substring&amp;field-1-0-0=classification&amp;field-1-1-0=product&amp;field0-0-0=noop&amp;keywords=&amp;keywords_type=allwords&amp;long_desc=&amp;long_desc_type=allwordssubstr&amp;product=GEF3D&amp;query_format=advanced&amp;remaction=&amp;short_desc=&amp;short_desc_type=allwordssubstr&amp;status_whiteboard=&amp;status_whiteboard_type=allwordssubstr&amp;type-1-0-0=anyexact&amp;type-1-1-0=anyexact&amp;type0-0-0=noop&amp;value-1-0-0=Technology&amp;value-1-1-0=GEF3D&amp;value0-0-0=&amp;votes=&amp;order=bugs.bug_id%20desc&amp;query_based_on="&gt;some other bugs...&lt;/a&gt; So many bugs? Yes, but only a very few lines of code to 3d-fy an editor. So, 3D-fy your editor and help us fixing the bugs!

You may ask, huh, that's great, but why should I want to 3d-fy my editor? Well, I can think of many use cases: display multiple diagrams within one 3D scene and draw inter-diagram connections, annotate your diagrams with 3D elements (e.g. metrics drawn as 3D bars on top of classes), exchange some of your 2D figures and provide real 3D editors...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-7681656327666120836?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/7681656327666120836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=7681656327666120836' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7681656327666120836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7681656327666120836'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/04/you-will-be-3d-fied-resistance-is.html' title='You will be 3d-fied. Resistance is futile.'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_xki1C_H6jyM/SdywlhtbCPI/AAAAAAAAABo/T2obwdwKPtU/s72-c/umlt-activity.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-853970328028808808</id><published>2009-03-25T18:04:00.003+01:00</published><updated>2009-03-25T18:38:26.841+01:00</updated><title type='text'>Waiting for "Accelerated 3D on the Web"</title><content type='html'>Yesterday, the Khronos group published a press release entitled &lt;a href="http://www.khronos.org/news/press/releases/khronos-launches-initiative-for-free-standard-for-accelerated-3d-on-web/"&gt;"Khronos Launches Initiative to Create Open Royalty Free Standard for Accelerated 3D on the Web"&lt;/a&gt;. That sounds like a candidate for enabling GEF3D editors within &lt;a href="http://www.eclipse.org/rap/"&gt;Eclipse RAP&lt;/a&gt; applications :-D The project sounds a little bit like &lt;a href="https://wiki.mozilla.org/Canvas:3D"&gt;Canvas 3D&lt;/a&gt;. With the X3D exporter, we learned that it is possible to use renderes other than OpenGL/LWJGL. But I'm not an Ajax expert, so I'm not sure how interactive 3D could be possible in that context. But it's nice to have visions ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-853970328028808808?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/853970328028808808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=853970328028808808' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/853970328028808808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/853970328028808808'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/03/waiting-for-accelerated-3d-on-web.html' title='Waiting for &quot;Accelerated 3D on the Web&quot;'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-4965313690160349896</id><published>2009-03-17T16:36:00.008+01:00</published><updated>2009-03-17T17:47:42.670+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='3D'/><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>GEF3D goes X3D</title><content type='html'>Due to problems of getting &lt;a href="http://lwjgl.org/"&gt;LWJGL&lt;/a&gt; &lt;a href="http://www.eclipse.org/projects/dev_process/ip-process-in-cartoons.php"&gt;IP approved&lt;/a&gt;, we were wondering how to address this problem. We didn't want to fall into the same trap again, so we thought about how to reduce GEF3D's dependencies from a specific rendering library. The problem was not trivial at all, so I decided to give it to a student, Matthias Thiele. He should analyze GEF3D and its dependencies to the currently used rendering library LWJGL in the context of a bachelor thesis. The idea was to refactor GEF3D (i.e. Draw3D) in order to minimize dependencies and to create a generic renderer interface. Making renderers plugable leads to the idea of using renderers not only for drawing on the screen, but for exporting or printing, too. So besides the refactoring, a new renderer should be implemented...

GEF provides several export formats, for example SVG for exchanging diagrams in a vector based file format. What SVG is for 2D diagrams, &lt;a href="http://www.web3d.org/x3d/"&gt;X3D&lt;/a&gt; is for 3D ones. So, besides the existing LWJGL-based renderer, Matthias implemented an X3D renderer. 

And Matthias did a great job! Based on his analysis of the GEF3D and Draw3D code, using cool tools like &lt;a href="http://www.intoj.org"&gt;InferType (see intoJ project)&lt;/a&gt;, we (that is Kristian, Matthias and myself) created a new design for Draw3D's rendering parts and we introduced an extension point to make renderers plugable! Matthias did most of the refactoring, actually before GEF3D was submitted to Eclipse. On the way we had to fix some bugs related to this (e.g. &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261775"&gt;a 3D position problem&lt;/a&gt; or &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261001"&gt;a dispose problem&lt;/a&gt;), but eventually it seems to work fine. Matthias wrote the X3D renderer, and he has &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=268973"&gt;contributed the code&lt;/a&gt; today. It is not available in the SVN yet, since we have to get it IP approved, first. 

Here you can see the result of the X3D export:

&lt;img style="display:block; margin:0px auto 10px; text-align:center; width: 400px; height: 254px;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/Sb_Od4wmKOI/AAAAAAAAABg/91vj7YebuE8/s400/x3dexport.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5314193098168215778" /&gt;

The original GEF3D diagram is shown at the bottom left. The large diagram is the very same image, exported as X3D and viewed with the &lt;a href="http://www.instantreality.org"&gt;instantplayer&lt;/a&gt;. The small image on the top left shows the very same X3D file, this time rendered with the &lt;a href="http://www.octaga.com"&gt;Octaga Player&lt;/a&gt;.

The current version of the X3D exporter is only a beginning. We certainly have to improve the quality of the diagrams, but it shows what is possible. Maybe other programmers write other cool renderers for GEF3D in the future ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-4965313690160349896?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/4965313690160349896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=4965313690160349896' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/4965313690160349896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/4965313690160349896'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/03/gef3d-goes-x3d.html' title='GEF3D goes X3D'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xki1C_H6jyM/Sb_Od4wmKOI/AAAAAAAAABg/91vj7YebuE8/s72-c/x3dexport.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-7121527308713077861</id><published>2009-02-13T12:22:00.007+01:00</published><updated>2009-02-13T13:29:14.920+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='3D'/><title type='text'>Unbelievable: Cooler than GEF3D ;-)</title><content type='html'>With GEF3D you can produce nice 3D diagrams. Of course, GEF3D is not the only framework which can produce 3D diagrams. An australien colleague, Paul McIntosh, uses X3D (the VRML successor) to create nice 3D UML diagrams, quite similar to the diagrams created with GEF3D. If you have thought, GEF3D's 3D diagrams are cool, well, then have a look at Paul's latest project. He combines his diagram with augmented reality:

&lt;a href="http://www.youtube.com/watch?v=-9iz_ldALcg"&gt;Watch the video at YouTube&lt;/a&gt;

&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/-9iz_ldALcg&amp;hl=de&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/-9iz_ldALcg&amp;hl=de&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;bold&gt;Just to get it right: This is &lt;em&gt;not&lt;/em&gt; GEF3D, but Paul's X3D-UML!&lt;/bold&gt;

This is amazing, isn't it. Jin, Paul -- great work! (Uh... don't you want to port this to GEF3D? ;-) ) 

If you want to see more of Paul's work, visit his website: &lt;a href="http://www.x3d-uml.org/"&gt;http://www.x3d-uml.org/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-7121527308713077861?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/7121527308713077861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=7121527308713077861' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7121527308713077861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7121527308713077861'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/02/unbelievable-cooler-than-gef3d.html' title='Unbelievable: Cooler than GEF3D ;-)'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-1672943220394918349</id><published>2009-01-14T14:29:00.006+01:00</published><updated>2009-03-09T15:51:23.465+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>GEF3D committed into SVN</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0;width: 128px; height: 128px;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/SW3qiDibYJI/AAAAAAAAABQ/_LO1P777_EE/s200/Hurdle+Berlin+Street+Art.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5291143008016359570" /&gt; After getting the preliminary approval I've just committed the initial GEF3D contribution into the SVN (GEF3D is participating in the parallel IP process). 

You can now check out GEF3D from 

&lt;span style="font-style:italic;"&gt;svn://dev.eclipse.org/svnroot/technology/org.eclipse.gef3d&lt;/span&gt;

In order to test GEF3D, you'll need the following projects (please add org.eclipse to the name):
draw3d, draw3d.geometry, gef3d, gef3d.ext, gef3d.gmf, and gef3d.examples.graph

Optionally you can check out the test and documentation projects, however there are currently not much tests and documentation available (but you can use the ant script in doc in order to generate the JavaDoc).

Draw3D, the 3D version of Draw2D, needs a renderer module in order to produce any output. Currently, only LWJGL is supported (or.eclipse.draw3d.lwjgl). The module only contains the Draw3D specific code, additionally you will need the LWJGL libraries. These are available via the LWJGL update site at &lt;a href="http://lwjgl.org/update"&gt;http://lwjgl.org/update&lt;/a&gt;. An description can be found at
&lt;a href="http://www.fernuni-hagen.de/se/personen/pilgrim/gef3d/lwjgl.html"&gt;http://www.fernuni-hagen.de/se/personen/pilgrim/gef3d/lwjgl.html&lt;/a&gt;.

The GEF3D example is running, but there is a &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261001"&gt;known bug&lt;/a&gt;. We are working on that already... Actually there are more bugs known, we will add them to Bugzilla as soon as possible ;-)

After checking out all these projects, the example editor can be activated by simply creating a file with appropriate extension: ".graphSample" for the 3D editor, ".graphSampleDia" for a 2.5D editor (i.e. 2D figures projected on 3D planes), and ".multiGraphSample" for a multi plane editor.

&lt;span style="font-weight:bold;"&gt;Update:&lt;/span&gt; The current installation instruction can be found at &lt;a href="http://wiki.eclipse.org/GEF3D"&gt;http://wiki.eclipse.org/GEF3D&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-1672943220394918349?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/1672943220394918349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=1672943220394918349' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/1672943220394918349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/1672943220394918349'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2009/01/gef3d-committed-into-svn.html' title='GEF3D committed into SVN'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xki1C_H6jyM/SW3qiDibYJI/AAAAAAAAABQ/_LO1P777_EE/s72-c/Hurdle+Berlin+Street+Art.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-5676791238135800057</id><published>2008-12-14T23:02:00.009+01:00</published><updated>2009-03-18T17:05:57.715+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>LWJGL Plugin at lwjgl.org</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; width: 126px; height: 128px;" src="http://1.bp.blogspot.com/_xki1C_H6jyM/SUWDhhkv4aI/AAAAAAAAABI/ZCrbNIQX3Lg/s200/lwjgl-logo" border="0" alt=""id="BLOGGER_PHOTO_ID_5279770750133199266" /&gt;As you may now, &lt;a href="www.eclipse.org/gef3d"&gt;GEF3D&lt;/a&gt; is moving to Eclipse. GEF3D uses &lt;a href="http://www.opengl.org/"&gt;OpenGL&lt;/a&gt; for rendering GEF diagrams in 3D, and since OpenGL is a C library, a Java wrapper library has to be used. &lt;a href="http://lwjgl.org"&gt;LWJGL&lt;/a&gt; is such a library and GEF3D uses LWJGL. It works with SWT out of the box, that is there is no need for using the SWT-AWT-bridge, which isn't working on Mac OS X (maybe this will change with the new Cocoa version of SWT?). The latest version supports OpenGL 3.0 and runs on Mac, Windows, Linux and Solaris. Unfortunately, the LWJGL library didn't got IP approved. So it cannot be added to the Eclipse orbit project.

The good news is, that &lt;a href="http://lwjgl.org"&gt;lwjgl.org&lt;/a&gt; now provides an LWJGL Eclipse plugin! Brian Matzon has installed the update site &lt;a href="http://lwjgl.org/forum/index.php/topic,2785.0.html"&gt;today&lt;/a&gt;. &lt;span style="font-weight:bold;"&gt;Thank you so much, Brian!&lt;/span&gt; It is the plugin I wrote for GEF3D, and it is now available at &lt;a href="http://lwjgl.org/update"&gt;http://lwjgl.org/update/&lt;/a&gt;. This plugin is interesting for people developing Eclipse plugins (or using GEF3D), since it simply wraps the LWJGL library (including the native code) into an Eclipse plugin. Not only the libraries are made available, but source code and documentation as well.

Another plugin will be made available shortly at the same update site, providing LWJGL support for standalone Java applications developed with Eclipse. This plugin will define a new library "LWJGL Library", that is it resolves the jars, native libs, sources and JavaDoc using the LWJGL plugins above. Since the native libs will be defined as well, a standalone Java application can easily be started using Eclipse's "Run As - Java Application" without the need to set a library path. So, this plugin saves some mouse clicks and configuration problems.

With these plugins, it is very easy for Eclipse developers to use OpenGL, either by an Eclipse plugin or by a standalone Java application developed with Eclipse.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-5676791238135800057?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/5676791238135800057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=5676791238135800057' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/5676791238135800057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/5676791238135800057'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2008/12/lwjgl-plugin-at-lwjglorg.html' title='LWJGL Plugin at lwjgl.org'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_xki1C_H6jyM/SUWDhhkv4aI/AAAAAAAAABI/ZCrbNIQX3Lg/s72-c/lwjgl-logo' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-4906263000177397594</id><published>2008-11-24T14:37:00.004+01:00</published><updated>2008-11-24T15:21:55.126+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Events'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><title type='text'>Eclipse Summit Europe 2008, Retrospect</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0;width: 128px; height: 128px;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/SSqyHVvluaI/AAAAAAAAABA/Weuk0JxqtUI/s200/ESE2008.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5272222152956164514" /&gt;This was my first Eclipse event so I was very excited. Unfortunately, my proposal about GEF3D was rejected. But anyway, it was a lot of fun! Here are some thoughts about some talks.

&lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=202"&gt;Quentin Glineur (Obeo) talked about model-to-model transformations&lt;/a&gt; with  &lt;a href="http://www.eclipse.org/m2m/atl/"&gt;ATL&lt;/a&gt; and &lt;a href="http://www.omg.org/spec/QVT/"&gt;QVT&lt;/a&gt;. Quentin listed several use cases for m2m-transformations: validation, refactoring, reexpression and consistency checking. He is currently implementing an engine for &lt;a href="http://wiki.eclipse.org/M2M/Relational_QVT_Language_%28QVTR%29"&gt;Declarative QVT&lt;/A&gt; based on the ATL virtual machine. Later I had a long discussion with him about model transformations. I'm really exited about his QVT implementation, which will be available at Eclipse.org.

&lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=51"&gt;Jan Köhnlein, Peter Friese, and Sven Efftige (itemis) presented xText&lt;/a&gt;. Since I'm fighting (but don't get me wrong: xText is a super cool tool) with &lt;a href="http://wiki.eclipse.org/Xtext"&gt;xText&lt;/a&gt; for a couple of weeks to get my own transformation language working, I was happy to hear thet the upcoming version of xText will solve a lot of problems, such as easier implementation of expressions or mixing of languages and grammars (I could use that for including OCL). I had lunch with Sven and it seems as if every little problem (or bug) will be solved in the next version of xText, it's a pitty that I have to finish my project before it will be released (feature freeze will be in March 2009, it will be part of Galileo). 

Since I have heard so much about &lt;a href="http://jazz.net/pub/index.jsp"&gt;Jazz&lt;/a&gt; I was especially interested in the &lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=220"&gt;talk by André Weinand (IBM)&lt;/a&gt;. For me Jazz looks pretty much like a tool set for Scrum, but this could be a misinterpretation by a Scrum master (like the guy with the hammer for whom anything looks like a nail). I'm still a little bit confused whether Jazz is freely available or not. But it looks definitely impressing and I'd like to work with it. For example, it introduces certain "isolation levels", for example a (personal) repository workspace. That is each developer has his own individual repository for backup and so on, and there will be a separated project repository. Thinking about that I'm wondering how I will work with my code when it has been moved to the Eclipse repository... 

A while ago I posted a master thesis proposal about visualizing model differences using &lt;a href="http://wiki.eclipse.org/index.php/EMF_Compare"&gt;EMF Compare&lt;/a&gt; and GEF3D. Unfortunately, no student has shown interest in this thing. Nevertheless it was very interesting listening to &lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=129"&gt;Cédric Brun (Obeo) about EMF Compare&lt;/a&gt;. While seeing his slides I was thinking about new cool visualizations, for example an Apple Time Machine like view of different model versions in a repository.

One of the highlights was &lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=156"&gt;Ed Merks' talk about "The Unbearable Stupidity of Modeling"&lt;/a&gt;. While I agree with most of his statements, for example the exaggerated use of the prefix "meta", I noticed (again) this little difference between the american and european conception of "model" and related terms such as "abstraction". I have to work out that thing in my thesis ;-). Maybe it's because the great book on model theory by Herber Stachowiak was never translated into English...
For people using the word "meta" too much, and thus maybe suffer under some kind of modeling fever (my adviser once  diagnosed me with "Modellithis"), I can recommend the very funny article &lt;a href="http://doi.acm.org/10.1145/1053331.1053347"&gt;"UML Fever" by Alex E. Bell&lt;/a&gt;, or (in severe cases) you may consider joining the &lt;a href="http://www.cs.york.ac.uk/puml/mma.html"&gt;Meta-Modellers Anonymous&lt;/a&gt;. Or simply read &lt;a href="http://ed-merks.blogspot.com/"&gt;Ed's blog&lt;/a&gt; regularly.

&lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=206"&gt;Scott Lewis and Marcelo Mayworm's talk about ECF&lt;/a&gt; (the Eclipse Communication Framework) was quite nice, they showed a small video about two pair programmers editing a single piece of source code using &lt;a href="http://www.eclipse.org/ecf/"&gt;ECF&lt;/A&gt;. It's very similar to my beloved editor SubEthaEdit. I'm wondering whether it would be possible to integrate ECD ad GEF3D somehow?

&lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=115"&gt;David Sciamma (Anyware Technologies) presented the new and upcoming features of the Ecore tools&lt;/a&gt;, that is the &lt;a href="http://wiki.eclipse.org/index.php/Ecore_Tools"&gt;Ecore diagram editor&lt;/a&gt;. Version 0.9 will be part of Galileo. Kristian Duske is currently working on a 3D port of these tools, so it would be nice to keep contact with the 2D developers. To be honest I didn't knew David is also developing these Ecore tools, I "only" knew him as the author of the TopCased UML editor. So it would be the second work of David which will be ported to 3D, since his TopCased UML editor is the one I'm using in all my transformation chain examples (thinking about that I'm reminded to update my 3D version to the latest TopCased UML 2 version, I hope that will be as quickly done as the previous version, that is within two days ;-) ).

Having all that trouble with licenses and third party libraries in the context of the review of LWJGL and JOGL (and even my initial GEF3D contribution), I was very curious about&lt;a href="http://www.eclipsecon.org/summiteurope2008/sessions?id=85"&gt;Janet Campbell's talk about "IP for Eclipse Committers"&lt;/a&gt;. IP is short for "intellectual  property" and this talk was especially about the "due diligence". That is (for people not that familiar with the Eclipse Process) there are a bunch of rules to be followed before code can be committed to Eclipse (i.e. some Eclipse CVS or SVN). IMHO this is an outstanding quality of Eclipse to be very concerned about these issues, even if I have a lot of trouble because of that (LWJGL was not approved, and JOGL is only to be approved because SGI has changed its free license agreements two months ago). So, a big thank you to all that people doing these legal reviews and stuff!

It was a really great experience to meet all that people I knew only from their email addresses, and especially people I was mailing with so much for the last couple of weeks because of GEF3D: Chris Aniszczyk, Ed Merks and Anne Jacko. It's a really great community, and I'm happy to be a part of it :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-4906263000177397594?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/4906263000177397594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=4906263000177397594' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/4906263000177397594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/4906263000177397594'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2008/11/eclipse-summit-europe-2008-retrospect.html' title='Eclipse Summit Europe 2008, Retrospect'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xki1C_H6jyM/SSqyHVvluaI/AAAAAAAAABA/Weuk0JxqtUI/s72-c/ESE2008.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-524777954163787924</id><published>2008-11-05T18:16:00.014+01:00</published><updated>2008-11-06T16:07:55.600+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='GEF3D'/><title type='text'>The Eclipse gef3d project is complete!</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0;width: 128px; height: 91px;" src="http://1.bp.blogspot.com/_xki1C_H6jyM/SRHdqZZACGI/AAAAAAAAAA4/xgxhFrkVCtk/s200/BotticelliCriclesOfHell.jpeg" border="0" alt=""id="BLOGGER_PHOTO_ID_5265233159812810850" /&gt;Three and a half months ago &lt;a href="http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg20571.html"&gt;Chris Aniszczyk asked me&lt;/a&gt; if I would like to make GEF3D an Eclipse project. At that time &lt;a href="http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg20565.html"&gt;I had released a first version&lt;/a&gt; of GEF3D under the EPL. I started GEF3D as part of my Ph.D. project (which still is an ongoing project), but I thought that others may be interested in that framework, so I released it. I didn't knew what I did when I agreed on moving GEF3D to Eclipse. Oh guys, this paperwork and this whole Eclipse process is overwhelming. Fortunately I have two great mentors,  Chris Aniszczyk and Ed Merks, helping me through all this just like Virgil guided Dante through all the nine circles of Hell. Thank you, guys!
After writing the proposal, creating the creation review slides, filling out several requests and other paperwork, I received a mail today with this subject: "The Eclipse gef3d project is complete!". That's cool! So, in the near future you will find GEF3D at &lt;a href="http://www.eclipse.org/gef3d/"&gt;http://www.eclipse.org/gef3d&lt;/a&gt;. It will need some time to find code there, because the code has to get clearance first. So long, you will find GEF3D at it's old location at &lt;a href="http://gef3d.org"&gt;http://gef3d.org&lt;/a&gt;. Stay tuned!
&lt;br/&gt;PS: I thought I've read about Dante in &lt;a href="http://ed-merks.blogspot.com/"&gt;Ed's Blog&lt;/a&gt; some time ago, I vaguely remember a slide on which he compared meta models (and meta meta models) with the circles of Hell, but I cannot find it anymore (I also remember his advice not to go there...). This was when Dante's trip to Hell came back into my mind. Actually I've never read the Divine Comedy. My girl friend once wrote a paper about Botticelli's Dante illustrations, and she made me love this special "comic strip" from the 15th century (and she explained me how to "read" it). I even had the luck to see the &lt;a href="http://www.smb.spk-berlin.de/d/feature/botticelli/"&gt;original drawings in Berlin&lt;/a&gt; once).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-524777954163787924?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/524777954163787924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=524777954163787924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/524777954163787924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/524777954163787924'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2008/11/eclipse-gef3d-project-is-complete.html' title='The Eclipse gef3d project is complete!'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_xki1C_H6jyM/SRHdqZZACGI/AAAAAAAAAA4/xgxhFrkVCtk/s72-c/BotticelliCriclesOfHell.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-7934509615649460099</id><published>2008-10-13T14:20:00.008+02:00</published><updated>2008-10-13T16:59:11.469+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>String.valueOf(Object obj) vs. Object.toString()</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0;" src="http://3.bp.blogspot.com/_xki1C_H6jyM/SPNFHYEARWI/AAAAAAAAAAo/VGRG_FKBLo8/s200/OderbergerStr_Berlin.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5256621183092147554" /&gt;I'm programming with Java for more than 10 years now and I have always used &lt;code&gt;Object.toString()&lt;/code&gt; to print out any kind of objects, usually for debugging and logging purposes. Looking at code written by others, this seems to be pretty usual. But there is a big problem: the object may be null. In this case, the call to &lt;code&gt;Object.toString()&lt;/code&gt; will result in a &lt;code&gt;NullPointerException&lt;/code&gt;. Sometimes ;-) I'm well aware of this problem, so I usually wrote 
&lt;code&gt;((obj==null)?"null":obj.toString())&lt;/code&gt;. By accident I found this nice function a day ago: &lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#valueOf(java.lang.Object)"&gt;&lt;code&gt;String.valueOf(Object obj)&lt;/code&gt;&lt;/a&gt;. What does it do? It's a static method and it looks like that: &lt;code&gt;return (obj == null) ? "null" : obj.toString();&lt;/code&gt;. Looks pretty familiar. Why didn't I found this method earlier? Carnival barker: "Are you using this method? If not, start today and bugs like &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=225760"&gt;this&lt;/a&gt; will become history!"

So, I would recommend to &lt;span style="font-weight:bold;"&gt;use &lt;code&gt;String.valueOf(Object obj)&lt;/code&gt; rather than &lt;code&gt;Object.toString()&lt;/code&gt;&lt;/span&gt;.

But there are others (e.g. &lt;a href="http://twit88.com/blog/2008/08/22/java-tostring-and-valueof/"&gt;here&lt;/a&gt; or &lt;a href="http://www.devx.com/tips/Tip/16234"&gt;there&lt;/a&gt;) who recommend to prefer &lt;code&gt;Object.toString()&lt;/code&gt;, because you can save one method call. IMHO this is the wrong place to start optimizations. I also found some tutorials which explain that you can use one or the other without discussing the differences. Maybe that's why I needed 10 years to find this nice static method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-7934509615649460099?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/7934509615649460099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=7934509615649460099' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7934509615649460099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/7934509615649460099'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2008/10/stringvalueofobject-obj-vs.html' title='String.valueOf(Object obj) vs. Object.toString()'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_xki1C_H6jyM/SPNFHYEARWI/AAAAAAAAAAo/VGRG_FKBLo8/s72-c/OderbergerStr_Berlin.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4884093826755448868.post-9165959885057158003</id><published>2008-09-24T18:24:00.021+02:00</published><updated>2008-10-20T16:29:34.978+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EMF'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>Simple Query-Language for Dynamic EMF Model</title><content type='html'>&lt;img style="float:left; margin:0 10px 10px 0;" src="http://4.bp.blogspot.com/_xki1C_H6jyM/SPNG-A4OZAI/AAAAAAAAAAw/CGbpVqvgJyo/s200/GraffityShadow_NYC.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5256623221273158658" /&gt;Usually I'm generating the model code from my ecore models. But sometimes I want to simply query a model, and in these cases a dynamic EMF model is good enough. I wrote a small helper class, providing a very simple query language for dynamic EMF very similar to the JSP Expression Language -- of course less powerful. You can query an EObject using a dot notation and square brakets for defining the index of a list item. E.g.
&lt;pre name="code" class="Java:nocontrols:nogutter"&gt;
Object street = eval( eobj, "person.address[0].street");
&lt;/pre&gt;
will return the street of the first address entry. The utility class will create nice error messages if something goes wrong. This is the grammar of the language:
&lt;pre&gt;&lt;code&gt;
query    := feature ( "." feature )*
feature  := &amp;lt;name&gt; ( "[" &amp;lt;index&gt; "]" )?
&lt;/code&gt;&lt;/pre&gt;
Maybe there's another way of accessing dynamic EMF that easy, maybe using some (at least for me: hidden) EMF utility class. If you know a better solution, please let me know!

Here is the utility class:
&lt;div style="width:97%; height:200px; overflow:auto;"&gt;&lt;pre name="code" class="Java"&gt;/**
* Author: jevopi
* (C) 2008 jevopi
*/
public class DynEcoreUtil {

 /**
  * Returns value of specified feature path. For specifying the feature path,
  * a dot notation is used, if a list is to be parsed, square brakets with
  * index are used.
  *
  * @param obj
  * @param featurePath
  * @return
  */
 public static Object eval(Object obj, String featurePath) {
  StringTokenizer st = new StringTokenizer(featurePath, ".");
  String feature = "";
  Object value = obj;
  try {
   while (st.hasMoreTokens()) {
    obj = value;
    feature = st.nextToken();
    if (feature.endsWith("]")) {
     int splitPos = feature.lastIndexOf("[");
     int index = Integer.parseInt(feature.substring(
       splitPos + 1, feature.length() - 1));
     feature = feature.substring(0, splitPos);
     value = fvl((EObject) obj, feature, index);
    } else {
     value = fv((EObject) obj, feature);
    }
   }
   return value;

  } catch (Exception ex) {
   if (feature == null || !(obj instanceof EObject)) {
    throw new IllegalArgumentException("Can't resolve "
      + featurePath + ", feature " + feature + " not found.",
      ex);
   } else {
    EObject eobj = (EObject) obj;
    EClass eclass = eobj.eClass();
    StringBuffer strb = new StringBuffer("Can't resolve "
      + featurePath + ", feature " + feature + " not found.");
    strb.append("Possible features of type " + eclass.getName());
    strb.append(": ");
    boolean bFirst = true;
    for (EStructuralFeature sf: eclass.getEStructuralFeatures()) {
     if (!bFirst) strb.append(", "); else bFirst = false;
     strb.append(sf.getName());
    }
    throw new IllegalArgumentException(strb.toString(), ex);
   }
  }
 }

 static Object fv(EObject obj, String name) {
  EStructuralFeature feature = obj.eClass().getEStructuralFeature(name);
  return obj.eGet(feature);
 }

 static Object fvl(EObject obj, String name, int index) {
  EList&amp;lt;object&gt; list = (EList&amp;lt;object&gt;) fv(obj, name);
  return list.get(index);
 }
}
&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4884093826755448868-9165959885057158003?l=jevopisdeveloperblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jevopisdeveloperblog.blogspot.com/feeds/9165959885057158003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4884093826755448868&amp;postID=9165959885057158003' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/9165959885057158003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4884093826755448868/posts/default/9165959885057158003'/><link rel='alternate' type='text/html' href='http://jevopisdeveloperblog.blogspot.com/2008/09/simple-query-language-for-dynamic-emf.html' title='Simple Query-Language for Dynamic EMF Model'/><author><name>Jens v.P.</name><uri>http://www.blogger.com/profile/14089732885850015120</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://1.bp.blogspot.com/-LtCV85zrqx8/Tt5Ph2MdVrI/AAAAAAAAAIk/W-fAzyvQA9I/s220/Jens.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_xki1C_H6jyM/SPNG-A4OZAI/AAAAAAAAAAw/CGbpVqvgJyo/s72-c/GraffityShadow_NYC.jpg' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
