Mar 1, 2011

Eclipse Code Recommenders 0.2!


We are happy to announce the second drop of Eclipse Code Recommenders today! Two weeks after the first drop two very exciting new features are ready to be released - and we are curios to hear what you think about them!

Feature #1: Java chain completion for Eclipse

How many times did you ask yourself "How do I get an instance of, say, IStatusLineManager" in scenarios like the one below?


And how much time did you then spent with shimming from one method call to another to find a call chain returning the type you were looking for - OR- reading Javadoc's Uses documentation to learn how to obtain such an instance?

If you have the feeling that this was quite too long, then this feature is for you:

Code Recommenders chain completion (described in more detail here) supports you in situations like the one above by automatically searching the API jungle for you, i.e., it takes every local variable, every field and every method it can invoke and follows its members until it finds a field or method returning an instance of the requested type.

For example when searching for an IStatusLineManager inside a ViewPart it returns:



Code Recommender chain completion also works on static classes:



And directly on method returns:









And even on method returns with type casts:









Many thanks to Andreas Kaluza and Gary Fritz who implemented this feature for Eclipse Code Recommenders!



Feature #2: Dynamic, example-driven templates engine

The second feature is something I'm getting really excited about.

Have you ever wondered how to deal with a framework's object you are not used to? While working with SWT you may stumbled across SWT Templates. SWT Templates offer common best practices of how to use SWT directly inside your IDE as code completion proposals. For instance, when triggered on the literal "Text" in your current editor, they propose a complete object creation pattern as shown below.


These templates are excellent for occasional users of SWT. However, these templates suffer from one major drawback: They are hand-crafted by experts and consequently only a small number of such templates exist - and only for SWT.

But what if you want to use JFace? Or core parts of Eclipse UI? Or whatever framework you use in your projects?

Let's stick with JFace to illustrate Code Recommenders' template completion engine. Assume that we want to use a JFace TableViewer inside our own view. When triggering SWT Templates on the literal "TableViewer" Eclipse tells you that there are no matching SWT templates (well, not a big surprise, eh?) :




But the question is: Couldn't we generate something similar to SWT Templates for every other framework too? Automatically? Maybe by just looking on how others used the APIs before?

Right, that's Code Recommenders' template completion engine! The idea behind our template engine is to identify common usage patterns from example code and to create something similar to SWT templates for every type we came across when analyzing code examples.

The result of this is shown below: The screenshots show the same situation as above, but just with our example-driven template completion engine and its proposals for JFace TableViewer:

Neat, isn't it? Well, as you might see, these templates are not always as perfect as hand-crafted examples but good enough to be valuable, right? What do you think? Do you like it? Let us know.

And as you may expect from call completion: Of course these templates adopt themselves based on what you have typed before! See this screencast for a detailed example of this:



Many thanks to Stefan Henß who did an amazing job to integrate Code Recommenders intelligent call completion engine into this pretty neat templates completion engine!

Where do I get it?
If you have Code Recommenders 0.1 installed already you can simply choose Help > Check for Updates in Eclipse. Otherwise you can get it from the Eclipse Marketplace or from our update site:
http://download.eclipse.org/recommenders/updates/dev/. You may also check the project homepage for more screencasts one code recommenders.

It's a drop! (not a release)
To avoid any confusions we had with our first drop, we want to explicitly state that we are currently publishing drops only but no releases as defined by the Eclipse Incubator guidelines. Before we can officially release new versions of Code Recommenders we have to pass an official release review by the Eclipse EMO (read more about that here). So far we didn't request a release review because some dependencies are under examination by the IP team - but should do so for later versions to avoid further confusion :-)

What's next?
For 0.3 the goal is to stabilize the current tool suite. Thus do no hesitate to file bugs against the project. The more the better!

Also some exciting news:
We will start collaboration with UC Irvine's Sourcer Research Group - a research group which has an excellent body of knowledge in how to create next generation of code search engines.  This will be an exciting project - we will blog about it separately when more details are out. But just to let them know that you like the idea: Click this link


Thanks,
Johannes & Marcel

3 comments: