Friday, November 8, 2019

Getting to the Source

As a Java developer using JDT, no doubt you are intimately familiar with Ctrl-Shift-T to launch the Open Type dialog.  You might not even realize this is a shortcut accessible via the Navigate menu.  So you probably will not have noticed that this menu also contains Open Discovered Type:

Eclipse has a huge variety of open source projects maintained in a bewildering collection of Git repositories.  Many are hosted at Eclipse:
Others are hosted at Github:

Finding the Git repository that contains a particular Java class is like finding a needle in a haystack.  This is where Open Discovered Type comes to the rescue.  Once a week, Oomph indexes every *.java file in every Git repository hosted by and  The Open Discovered Type dialog loads this information to populate a tree view of all these packages and classes.

Please read the help information the first time you use it.  It was written to help you get the most out of this dialog.  Also be patient the first time you launch the dialog; there's a lot of information to download.

Suffice to say, you can use the dialog much like you do Open Type.  So here we search for JavaCore and discover all the classes with that name:

We can select any one of them and discover all the Git repositories containing that class and we can use the context menu for each link for each repository or for the specific file in that repository to open the link where we want it opened.  From that link, you can of course see the full history of the repository or specific file.

As a bonus, if this repository provides an Oomph setup, you can easily use that Oomph setup to import the sources for this project into your workspace. If there is no Oomph setup, you'll have to do that manually.

In any case, contributing to Eclipse open source projects has never been easier.

Thursday, August 29, 2019

And Now for Something Completely Different

It's been 5 years since I last blogged, so I had to delete 500 SPAM posts when getting started again.  Much has happened over the past years, some of them not so great. When you start to get old like me, you must deal with the older generation gradually passing on and health problems, such as coronary re-plumbing, can become an ugly fact of life.

I've been working with itemis for the past 11 years, but that now draws to a close.  I wish to thank them for their generous support over all these years.  Many of you might thank them as well because much of what I've contributed is thanks to their funding.  Though admittedly I have the nasty habit of working like a maniac, beyond any reasonable number of working hours, regardless of whether or not there is financial reward.  Cool things are just so compelling. But the worst habit then is not bothering to document or advertise all these cool new features as they become available, but rather to dive into the next obsession because somehow that's more compelling.  Compulsion is a bit of a Merks' family trait, e.g., my sister has more than 20 dogs, though it's easy to lose count...

In any case, most of my obsession over the last year has been related to working with Airbus.  I don't normally talk about my customers, but given they were gracious enough to allow me to demo at last year's EclipseCon the software being developed at Airbus, it's common knowledge anyway.  My goodness but that was a creative and cool project! Unfortunately that too has, as is the case for all good things, come to an end.

I immediately dove into generating a quality report for the Eclipse SimRel p2 repository; there's no rest for the wicked nor for the compelled.  I used EMF's Java Emitter Templates (JET) for implementing that, just as I did for generating the full site information for  EMF's Update Sites  as part of migrating the build to Maven/Tycho.

Speaking of which, did you know that you can make it trivially easy for your contributors to set up a development environment? Just have a look at EMF' build page.  Also, did you know that there exists such a thing for the complete Eclipse Platform SDK as well? Of course not, because I never bothered to tell you!

What's really supergeil (yes, I live in Germany and speak fluent Denglish) about the installing an environment with the full Platform SDK, or some subset there of, is that you can easily see all the Git history of each source file, so you can see what exactly has changed and evolved.  Also, when developing new applications, you can easily search for how the Platform implements those things; then you can snarf and barf out your own solutions, with all due respect for the EPL of course.  You can even find out all the places that a constant is actually used; you cannot do that against binaries because constants get in-lined.  Also, if you see some label in the IDE, you can search for where it comes from, some *.properties file somewhere no doubt, and then you will know the name of that property and can easily find where that's defined and how that's used in the code.  You might even contribute fixes via Gerrit commits!

But I digress.  I was using JET to generate a nice helpful web page with information about all the problems in the SimRel repo, or in any arbitrary repo actually, i.e., invalid licenses, unsigned content, missing pack200 files, duplicate bundles, inappropriate providers, and so on. But then I got frustrated that JET templates eventually get really hard to read, especially as they become more complicated.  Then, when you need it the most, all the nice features of JDT are missing while editing the scriplets and expressions in that template. So as I am wont to do, I digressed further and spent the better part of the last two months working on a rich editor for JET.  I'm sorry (not!) that I had to violate a few API rules to do so, but alas, API rights activists is a topic for another blog because that's a long digression.  The good thing is that the JET editor is finished now; it will be in 2019-09's M3.  Here's a sneak preview:

Yes, that's content assist, just is if were in a real Java editor! Not only that, this time I wrote documentation for it in EMF's doc bundle. And, to top that off with icing, this time I blog about it.  Perhaps only three people in the world will ever use it, but I am one of those three people and I love it and I need it even for working with EMF's code generation templates too. So now I can pop this off my digression stack and go back to generating that p2 repo quality report.  I've been doing that for the past week, and it's almost ready for prime-time.

But then at this point, I must ask myself, where is the financial gain in all this?  My local neighborhood fox, I've named him Fergus,  might be trying to tell me something.

Perhaps you should be a little more sly.  Perhaps the endless free goodness too must come to an end...

Monday, October 6, 2014

A Floor Wax or a Dessert Topping?

For those as old as I am and as influenced by American culture as most Canadians certainly are, the question "Is it a floor wax or a dessert topping?" likely rings a bell. Unfortunately, because the internet aims to curb the exchange cultural media—I use the term "cultural media" loosely in this case—you likely can't watch the video via that Wikipedia link where you live, but there are alternatives, thanks to the wonders of Google search. How could modern society, and effective software developers, function without Google?  It makes a guy dizzy just to think about it!

I bring this floor wax verses dessert topping question up because EclipseCon is just around the corner.  Like a floor wax, it's a valuable utility, in this case for learning cool new things and for interacting with experts and other like-minded people. Yet like a dessert topping, it's fun, because of the social events, and fattening, because the food is so good. I'm certainly excited to attend yet another EclipseCon. Barring death or disease, I wouldn't miss it! I've been to every EclipseCon and Eclipse Summit, except one.

Eike and I will be presenting Oomph, which is like a floor wax—reducing hours of tedious work to several minutes of automation— and like a dessert topping—recording your preferences and propagating them to all your workspaces.  Perhaps the latter feature isn't even technically a dessert topping, not if you consider the top reasons why some people hate Eclipse. In particular, consider how many of those reasons relate to issues that are addressed by appropriate preferences. Of course that leads to an endless debate about what's the best default preference, i.e., surely no one wants to use Cp1252 as their default workspace encoding. We intend to address this issue with Oomph, so come to our talk and find out about the grand things that are in store.

The biggest problem with Oomph right now is documentation.  Which self-respecting developer wants to spend time on that?  Not only is it a motivation issue, authoring help-center documentation is beyond horrible. So, being tool smiths and OCD, we've worked on making that much easier.  The basic idea is that the documentation is authored as Javadoc, with numerous doclet extensions. It is processed to generate the help center HTML. The overall processing includes a preprocessor phase to produce model diagrams, screen captures, Java snippets, XML snippets, and even tree views complete with their associated properties view.  All this makes the author's life simpler and the end result is way beyond cool. In particular, have a look at the Setup Resources section; this link is likely to change in the coming days when we refactor the documentation using JDT.

Not only have I been busy with these Oomph-related things, Xcore has some dramatic performance improvements in the latest Luna service release thanks in large part to my itemis colleague, Stefan Oehme, a member of the world-renowned Xtext team. And of course there was the usual service and support work associated with EMF itself, but everyone takes that for granted. I also want to thank Jonas for revamping the embarrassingly outdated Modeling home page along with EMF's home page. It's hard to keep up with all these driving factors, but it's definitely better than being bored!

I hope to see you in Ludwigsburg at the end of the month.  Feel free to test my much-improved German skills!  Though be prepared to hear me complain about the complexities of German grammar. Sollte das ein das, ein die, oder ein der sein? Translated literally to the pointless question, should that a the, a the, or a the be?  Note the three gender articles and dangling verb. Don't expect to get the point of a German sentence until you get to the very end.

Friday, February 14, 2014

Shoes for the Shoemaker

We shoemakers are typically so busy making shoes for others that we and our children are often out and about in shoddy shoes if not barefoot. There is also a strong tendency in the wider Eclipse community to find fault without taking action, looking instead to others to magically fix problems while feeling entitled to "motivate" those actions with poisonous complaints. We should consider carefully what's wrong with this picture.

Consider for example the all-important Eclipse Platform project and the perennial concern about the limited contributions it receives.  Of course this same concern extends to all projectswe'd all love high-quality contributions associated with each and every Bugzilla reportbut let's just take the platform as a case in point.  Suppose you would like to provision an IDE for working with the platform SDK source so you can commit your bug fixes to Gerrit.  All you need to do to get started is follow a few simple steps.

That's right, in the modern age of integrated development environments, you're expected to act as an interpreter for converting human language scripts into machine operations.  Does that not strike you as completely anachronistic?  Of course you're likely already doing this each time you provision an IDE to work on your own project, and you likely don't keep up with the release train milestones because it's a royal pain to do all this work each time there's a new version.

This whole problem irritates me to the extreme, not so much the platform's specific problem, but the fact that I have the same problem for EMF and for every project I use and to which I wish to contribute.  Just so you don't think I'm throwing bricks at the platform, have a look into my glass house, in particular at the extremely lovely analog of the platform's wiki page for setting up EMF's source. Good luck getting that to work!  What that heck is CVS? 

Not only is it anachronistic to follow scripts manually, it's always the case that these scripts become dated and are in need of constant maintenance, which, as busy developers, we don't have time to do.   Compound that with the fact that the scripts are buggy, you should not be surprised that when you treat the community like monkeys, you end up mostly with a lot of hooting.

Oh well, so much for the whining, sniveling, and complaining part, this problem calls for action.  Eike and I, being inherently lazy, don't even want to follow these kinds of scripts ourselves so we've worked on an  alternative approach. Yes, there's still a script for bootstrap purposesyou can help improve itbut here's the synopsis:
  • just as you would any Eclipse package, download the appropriate version of the Eclipse Oomph installerwe need to do some brand marketing instead of just calling it the "Setup tool",
  • unzip it,
  • run it, 
  • select the project you wish to set up, 
  • go for coffee, 
  • and come back to enjoy your fully provisioned IDE along with that fresh cup of Java.
Here's how you'd provision an IDE for working with the platform's SDK:

Here's the end result:

Of course a workspace with the entire Eclipse SDK as source is a bit aggressive, but it's a great proof of concept that it can be done for the entire platform. Be patient though, Rome wasn't built in a day: the platform's code base is very large, so cloning it all takes time, for me more than an hour!  Try a simpler project, like the EMF Core SDK, if you want more immediate gratification, and keep in mind that this would not be any faster if you did it manually.  Note that Oomph was built with EMF.  Did I mention that we're inherently lazy?

It's quite easy to author an executable setup script for your own project.  Here's how the platform's setup script looks:

The platform's script is quite complex because the platform itself is complex. Not only that, there are gotchas to get the platform to build without errors, e.g., an inherent need to install several JREs, which I avoided by changing project-specific preferences to not treat an imperfect JRE match as an error. You can see there are tasks to set global preferences, a task to install additional tools, e.g., the EE profiles feature, tasks to clone the dozens of repos, a task to materialize the target platform, a task to populate reasonable dynamic working sets, and so on.  Unfortunately it's apparently very hard to build all the platform's Ant jars and there appears to be a platform bug that requires an IDE "Restart" followed by a "Build All" before everything builds without errors and with less than 17,000 warnings. Note that the provisioned target platform contains only bundles from Orbit and from Jetty; I have no idea how the Jetty folks provision an IDE to work with source.

Eike and I intend to maintain an index of all Eclipse project setup scripts so that our community of contributors can enjoy one-stop shopping.  In addition, there are already folks looking to maintain indices for other open source forges.

The script-authoring documentation is a work in progress, but of course you can look at all the working examples as a basis for creating your own; remember to turn on "Live Validation" in the editor to catch problems early.  Note that if you provision the CDO Release Engineering environment using Oomph, you'll have all of Oomph's source code and some example scripts at your fingertips.  Contributions to the project are welcome; your changes can be easily committed to Gerrit. If you have questions, please use the EMF newsgroup and prefix the subject line with "[Oomph]". If you find problems, please report a Bugzilla. And finally, if you're so inclined, come see our EclipseCon presentation!

As you might expect, we're not the only ones who recognize the need to solve this vexing problem nor the only ones with a solution for it.  If you need this same type of thing in an enterprise context, you'll want to have a look at the cool features of p3, e.g., carefully managed inside-the-firewall p2 repositories.

As a footnote, it's committer representative election time again.  How will you decide how best to cast your vote given the 4 available choices this year?  Of course you'll want people who actively represent your committer interests at Eclipse, so you might glance at commit stats to see who's actively committing to notice these lines-of-code-committed stats over the past 1, 3, 6, and 9 months:

As a caveat, keep in mind that modeling is a great productivity amplifier!  Not only that, code commits are not the only significant committer activity and are mostly certainly not a good measure of who will best represent your interests.  On that note, I can only promise that, if elected, I'll continue to do my best to make sure Eclipse is a great place to be.  You can definitely count on me to take action where action is needed.

Thursday, April 25, 2013

Modeling: Eclipse Daze at JAX 2013

Eike and I (well, mostly Eike because I'm faul) have organized this year's Eclipse Modeling Day at the JAX conference in Mainz. We hope to see you in Gutenbergsaal 2 on Friday, March 26th, at 9:00AM sharp. Eike will perform feats of magic to entertain you.

We think you'll really enjoy the mix of technology talks from Eclipse project leads and experienced industrial users.

Wednesday, January 16, 2013

Decorating with EMF

I recently added something totally cool to EMF.  It's so cool, you might want to use it even if you don't use EMF for anything else.  You're probably aware that JFace provides tool tip support for column viewers and of course, as a user of JDT, you've likely made extensive use of the Java editor's Javadoc hovers which display HTML-based information that even allows hyperlink navigation.  It's effectively a mini browser.  With the new feature I added, you can easily display HMTL-based hover information in any column viewer. You can see that in action with the sample I created; you'll need the latest build.  It's an RCP application that looks like this:

It displays a simple hand-written file system "model" where the files have links to other files. The hovers allow you to navigate those links within the tree. Note that EMF ships with many fine-grained features, so you need only depend on EMF's Common UI feature to exploit this, i.e., just two very small plug-ins, not the whole EMF runtime.

I used this basic feature to implement improved validation support. You can try this out by enabling Sample Ecore Editor → Live Validation.  With that enabled, whenever you change the model, the tree view will be decorated with validation results.  For example, when you create a new EClass, it won't have a name, and that's invalid.  The hover displays that as follows:

Note that the validation decorations propagate up the tree. The hovers at these higher levels display a composed result which contains links to allow you to navigate directly to any child object with a problem.

Also, the properties view itself is decorated, so a feature with a problematic value will be called out and selecting it provides details in the status line.

Pretty cool hey? And now for the best part: this has all been generated.  So if you'd like to see this type of thing in your own model, just set the GenModel's Editor Decoration property to Live, regenerate the editor, and enjoy the results. Have a look at the underlying infrastructure and let your imagination run wild with creative ideas of your own.

I'd like to thank itemis, the generous sponsor of cool things, for funding this year's "Christmas tree decoration" effort. The benefits will definitely outlast your decorated Christmas tree.

Wednesday, January 9, 2013

EMF Can Do What?

I've been very busy these past months implementing all kinds of cool new things. Of course I always intend to do some marketing for them, but once each problem is solved, it loses its glitter and I quickly focus on the next cool thing.  I know I really should take time to make the community aware of new capabilities, because it makes those things more valuable in reality, but I still prefer to focus on development.  Oh well, we all know where the road paved with good intentions typically ends.

As an example, I'll bet very few people are using using a ResourceSetImpl.ResourceLocator, something I added in EMF 2.8, because they don't know they can. You can see how it's used in the unit test, i.e., just create it and you're done.  What does it do? It allows ResourceSet.getResource to find the resource without searching the whole resource set.  If you look closely at how it's normally implemented, you can see it uses quite an expensive linear search that is made even more costly by the need to normalize each resource's URI to do proper comparison.  By adding a locator, the cost reduces to a fast mapped look-up where the performance is independent from the size of the resource set. Most importantly, the map is properly maintained, so no matter what you change, including changes to the URIConverter's URI mappings, you'll always find the right resource in constant time.  So if your application has a large number of resources, your should consider using it.

The most recent example of a cool new feature is support for reified types. You'll only notice this change if you use generics extensively and you regenerate your model, assuming I've not broken anything in the process, because then you might notice sooner!  Consider the following model:

Notice that in menu we know the children and selected element should be menu elements. With the latest build, the generator realizes that too, so it generates the following overrides in the menu's implementation class.

In other words, the generator will ensure fail-fast, type-safe behavior.  Not only that, the edit support is also enhanced.  That is, you can create any type of thing in a container.

But you can create only a menu element in a menu.

Similarly, you can select any type of element in a container.

But you can select only a menu element in a menu.

How cool is that?  You might ask yourself, who would model in this way?  Look closely, you'll find it right under your nose.  I have the good intention to blog about other cool things you probably didn't realize were available.