Welcome to Planet Eclipse

September 02, 2010

Ian Skerrett
Ian Skerrett

Eclipse Stories: Cell Biosciences

As I mentioned yesterday, we want to encourage people to tell their Eclipse story.  Last week Cell Biosciences told their story at the Eclipse Day at the Googleplex.   You can view their entire presentation but I have added a summary on the Eclipse Story wiki and below.

btw, Cell Biosciences is looking a great Eclipse developer to join their team.  Check out the presentation for details.

Eclipse Story

Title: Protein Analysis with Eclipse RCP

Name: Cell Biosciences

Cell Biosciences is a company that provides instruments and software to analyze the proteins in the human body. Their systems help life science researchers in research institutions and pharmaceutical/biotechnology companies.

Cell Bioscience uses Eclipse RCP to create desktop applications to analyze the data sent from their imaging machines. The RCP based application use allows researchers to setup, run and analyze data experiments. The applications feature graphs, images and tables of data that can be sliced in different ways.

In addition to RCP, Cell Bioscience uses Eclipse as their development tool platform. Their systems include Java, Python, Javascript and C/C++ code. To support their development needs they use PyDev, Subclipse, Egit, JUnit, SWT Bot, TPTP Test and Performance, WTP WSDL editing and Aptana for Javascript.


Heiko Seeberger
Heiko Seeberger

SLF4S - Logging the Scala way

Do we need another logging framework in the Java/Scala world? Certainly not! As Scala is fully "downward" compatible to Java, we can use whatever Java logging solution we want. And there are many, aren't there?.

So why SLF4S? Well, SLF4S isn't another logging framework, but a very thin Scala wrapper around SLF4J which has emerged as the leading Java logging solution. Why do we need a Scala wrapper for SLF4S? Well, there are some nice Scala features that can make logging even easier and/or more performant.

First, SLF4J Loggers use by-name parameters which are only evaluated if needed/accessed. When logging "traditionally", we often create messages by concatenating Strings or using the String.format method, even if we don't need these messages in the end because the logging level is not enabled. Of course we could "manually" check whether the logging level is enabled, e.g. by calling logger.isDebugEnabled, but we often don't, because it's cumbersome. With by-name parameters we can simply call our log methods and let SLF4S check whether the log level is enabled. Just take a look at one example:

def debug(msg: => String) {
require(msg != null, "msg must not be null!")
if (slf4jLogger.isDebugEnabled) slf4jLogger debug msg
}

Second, SLF4S offers a Logging trait which can be mixed into any class to make a Logger instance available. That particular Logger will be initialized with the name of the class it is mixed into which is a common use case.
class MyClazz extends SomeClazz with Logging
...
logger debug "SLF4S just rocks!"
...

Of course you can create Loggers with arbitrary names by calling Logger("SomeSpecialName").

Last but not least, SLF4S offers implicit conversions from "usual" SLF4J Loggers into "pimped" SLF4S Loggers.

Ah, and of course, SLF4S is OSGi compliant. But that's not a big surprise, taking into account that the authors are OSGi fanboys and SLF4J is OSGi compliant, too.

Scott Lewis
Scott Lewis

Asynchronous Remote Services - choices, choices

In ECF's Helios release, we released an implementation of the OSGi remote services standard specification (chapter 13 in compendium).

In addition to the full spec implementation...which is based upon synchronous remote service proxies...we added support for asynchronous remote services. This provides non-blocking access to remote OSGi services. This gives remote service consumers choices...allowing them to invoke remote services synchronously (i.e. by making a blocking method call on the proxy), and/or asynchronously (with a guarantee that the calling thread will not block).

I think that one nice thing about this approach is that the service host implementer has to do exactly nothing to make these consumer choices available. The implementation of the service host is exactly the same.

There are two styles of asynchronous access supported: an asynchronous callback (like GWT), and a future result, from the Actor model of computation. These two styles of of asynchronous access...along with the specified synchronous proxy...provides remote services consumers with some useful choices for creating reliable distributed systems and applications.

Chris Aniszczyk
Chris Aniszczyk

The Value of Documentation in Open Source

I’ve been starting a lot of documentation work lately for the EGit/JGit projects and happened to come across this timely article from Forbes. If you don’t want to read it, the gist of it is that solid documentation is more important than you think… especially when it comes to attracting a user and developer base. Here are some quotes…

“I can report that my company receives 70% plus of our site traffic from organic sources, and our documentation generates more than half of our overall site traffic. Furthermore, over half of our lead generation is driven by our documentation.”

While the article specifically mentions commercial software, I think the lesson of having solid and findable documentation apply to the open source realm. I mean, when’s the last time you’ve come across an open source project that you praised their documentation efforts? I can maybe count two total in my lifetime. As open source developers and project leads, we tend to put documentation last and our expectation is that users would pitch in to help. As users, we just want good documentation and don’t believe it’s our responsibility to help out necessarily…

So next time you’re working on that feature, weigh it versus taking some time to document things for your users. If you’re in Eclipse land, feel free to take a look at our documentation guidelines and some examples on how to crowdsource your documentation efforts a bit.

Birt World
Birt World

BIRT Image - Report Item

BIRT has many ways to include images within a report. Images can be used in BIRT styles, as watermarks, in text elements, and placed within the report using an image report item. In this post I will cover some of the details needed to work with images that are inserted using the Image report item.

The image report item can retrieve images in four different ways. 1 -Through a URI, 2 – as an image in the resource folder, 3 – as an embedded image, 4 -or by using a dynamic image. Each of these methods is described below with examples. In addition some of the examples use onCreate scripts written in JavaScript. While these examples use JavaScript, they could also have been written in Java.



URI Images
The first way is to retrieve an image with the image report item is to use a URI specification. This method is pretty straight forward and the value can be entered as a constant or as a JavaScript expression. Constants are processed faster by the engine but are harder to make dynamic. An example of a constant expression for a URI image would be as follows:


http://www.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png


Note: Do not put quotes around the expression unless JavaScript Syntax is selected. An example of using a JavaScript expression is presented below.


if( params["dynamicimage"].value == true ){
"http://www.google.com/intl/en_ALL/images/srpr/logo1w.png";
}else{
"http://www.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png";
}
This expression checks the value of the dynamicimage report parameter, and then based on its value, sets the value of the URI.
The URI can also be set using an onCreate event handler for the image report item. The syntax for this approach would look like:
this.URI = "http://tomcat.apache.org/images/tomcat.gif";

//for a local file use:
//this.URI = "file://C:/test/birtlogo.png";


Resource Folder Images
BIRT uses a resource folder for storing report libraries, style sheets, images, jars, js files, properties files or virtually any file that you will need access to at runtime. While in the design environment the resource folder location can be set using the Windows->Preferences->Report Design->Resource setting. This can be set for the entire workspace or on a per project basis. At runtime you can set the resource folder in the web.xml if you are using the viewer. If you are using the engine API you can set the resource folder using the EngineConfig class’ setResourcePath method. When using a resource folder image, all that is needed is to specify the image name as it is defined in the resource folder. You can also set a JavaScript expression for the image name. For example:


if( row["QUANTITYORDERED"] > 30 ){
"green.png";
}else if( row["QUANTITYORDERED"] > 25 && row["QUANTITYORDERED"] <= 30){
"yellow.png";
}else{
"red.png";
}


This expression checks the row data to determine which resource folder image should be rendered. The same type of checks can be made if you are using the onCreate script event for the image element.


var myqty = this.getRowData().getColumnValue("QUANTITYORDERED");
if( myqty > 30 ){
this.file = "green.png";
}else if( myqty > 25 && myqty <= 30){
this.file ="yellow.png";
}else{
this.file="red.png";
}


One thing to note in the above is that the column value QUANTITYORDERED is the binding column name, not the dataset column name. See the binding tab on the table in the attached example.
Images can also be placed in jar files within the resource folder. If your image exists in a jar file, you can use a script expression similar to the following to specify the image to retrieve.


var jarfile = reportContext.getResource("birtimages.jar");
myfulljarimage = "jar:"+jarfile.toString()+"!/green.png";
myfulljarimage;


The getResource method of the reportContext object is used to return the location of a file in the resource folder. Using the location of the file and the jar protocol, the image can be specified.

Embedded Images
BIRT allows images to be encoded directly into the xml report design. Images can be added by right clicking on the embedded images icon in the outline view of the report and selecting “New Embedded Image”. After selecting the image, the outline view is updated and the data for the image is encoded in to the design. You can also add embedded images to the report using the add image button of the image report item editor.



Once the images are embedded into the report, you can add the image report item to the desired location, choose the embedded image radial, select the image name and click the insert button.



If you wish to change the image dynamically, this can be done using an onCreate script. In the onCreate script specify the image name using the imageName property.


this.imageName = "eyellow.png";



Dynamic Images
Dynamic images allow Blob images to be inserted into the report. Typically this type of image is tied to a data set column through either the image’s dataset bindings, or the container element’s bindings (eg Table). The sample database, which is delivered as part of BIRT, contains a Blob type column in the PRODUCTLINES table. The example report used in the post has an example of using this column in conjunction with the image report item.



A developer can also use an onCreate event script to set the image data. When doing this, the image data should be in a byte[]. Presented below is an onCreate script that uses the ImageIO class to read a file, a URL, an image from the resource folder, or an image in a jar file in the resource folder. Uncomment the section of the script for the desired image location.


importPackage(Packages.java.io);
importPackage(Packages.java.lang);
importPackage(Packages.java.net);
importPackage(Packages.javax.imageio);

//File Based
//var myfile = new Packages.java.io.File("c:/test/green.png");
//var img = ImageIO.read(myfile);

//URL Based
//Jar image in resource folder
var jarfile = reportContext.getResource("birtimages.jar");
var myfulljarimagestr = "jar:"+jarfile.toString()+"!/red.png";
var myurl = new Packages.java.net.URL(myfulljarimagestr);

//Image in resource folder
//var myurl = reportContext.getResource("green.png");

//Image at url
//var myurl = new Packages.java.net.URL("http://www.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png");

var img = ImageIO.read(myurl);
bas = new ByteArrayOutputStream();
ImageIO.write(img, "png", bas);
this.data = bas.toByteArray();





The example used for this post is available at Birt-Exchange. To setup the example, copy the birtimages.jar and the three supplied images to your resource folder.

Donald & Ralph
Donald & Ralph

Welcome SBB / CFF / FFS to the Eclipse Foundation



The Swiss Railway SBB has just recently joined the Eclipse Foundation as an Associate Member.

Transporting 327.5 million passengers and 50 million net tons of freight every year the company is by far the biggest travel and transport company in Switzerland.

Having experienced their great services for the time I was living in Switzerland I appreciate very much that this very service oriented organization has become a large consumer of the Eclipse platform and Eclipse related services.

We have seen presentations of their applications on various occasions such as the Eclipse Summit, and we look forward to an even closer relationship with SBB through the newly signed membership.

JFace Data Binding Team
JFace Data Binding Team

A new direction for bindings?

I'm happy to report that I've been given company approval to port the relevant components of our Flex data binding library back to Eclipse Data Binding.

I haven't started the actual port yet--there are still some concepts on the Flex side that are not a perfect match to Java and existing idioms in Eclipse Data Binding. You'll see what I mean.

To avoid conflating the port to Java with the general API I'm going to just present what the Flex API looks like.

  Bind.from(source, "foo")
.to(target, "bar");

This binding watches the source.foo property, and writes the new value to target.bar each time a change it detected. Now add some validation and conversion magic:

  Bind.from(source, "foo")
.validate(Validators.stringToNumber)
.convert(Converters.stringToNumber)
.validate(Validators.greaterEqual(0))
.validate(Validators.lessThan(10))
.to(target, "bar");

Here we've added several additional steps in the pipeline.

  • After source.foo changes, we first validate that the string can be converted to a number. If so the pipeline continues to the next step, and terminates otherwise.
  • Next we convert the string to a number
  • Now validate that the number is greater than or equal to zero. If so the pipeline continues to the next step, and terminates otherwise.
  • Now validate that the number is less than 10. If so the pipeline continues and the number, now verified to be in the range [0,10), is written to target.bar.

Now suppose our binding is misbehaving somehow, and we want to troubleshoot. We can add logging steps to the pipeline in between the other steps so we can see exactly what is going on:

  Bind.from(source, "foo")
.log(LogEventLeven.INFO, "source.foo == {0}")
.log(LogEventLeven.INFO, "validate {0} is a number")
.validate(Validators.stringToNumber)
.log(LogEventLeven.INFO, "convert {0} to a number")
.convert(Converters.stringToNumber)
.log(LogEventLeven.INFO, "validate {0} >= 0")
.validate(Validators.greaterEqual(0))
.log(LogEventLeven.INFO, "validate {0}

.validate(Validators.lessThan(10))
.log(LogEventLeven.INFO, "set target.bar = {0}")
.to(target, "bar");

(In Flex, string formatting is done with {n} format instead of the %s syntax which Java inherited from C. The log statement passes the values in the pipeline as additional arguments which you can reference in log statements.)

These log steps are a real lifesaver for tracking down and squashing bugs in your binding code.

If you've already worked with Eclipse Data Binding you may have noticed something else: you are no longer constrained to the standard data-binding pipeline. You are free to add steps in the pipeline wherever you like and in any order you like.

Next up is two-way bindings. The bind class provides a twoWay method which connects two bindings to the other one's starting point:

  Bind.twoWay(
Bind.from(source, "foo"),
Bind.from(target, "bar") );

is equivalent to:

  var lock:Lock = new Lock();
Bind.from(source, "foo")
.lock(lock)
.to(target, "bar");
Bind.from(target, "bar")
.lock(lock)
.to(target, "foo");

Notice that each binding has a "lock" step in the pipeline. Only one binding can hold a lock at a time. This solves the common infinite loop problem:

  • source.foo changes. binding one executes, writing the value to target.bar
  • target.bar changes. binding two executes, writing the value to source.foo
  • source.foo changes. binding one executes, writing the value to target.bar
  • ...
  • stack overflow!

Since only one binding can hold the lock at a time, this is what happens instead:

  • source.foo changes. binding one acquires the lock and executes, writing the value to target.bar
  • target.bar changes. binding two attempts to acquire the lock but it is already acquired. binding two aborts.
  • binding one releases the lock

You should never add the same lock more than once to a single binding, since that would guarantee that the binding will never run.

Two-way bindings can use validations, conversions, logging, locks etc just like regular one-way bindings (since two-way bindings are just two one-way bindings wired up to eachother):

  Bind.twoWay(
Bind.from(person, "birthDate")
.convert(Converters.dateToString(dateFormat))
Bind.from(heightText, "text")
.validate(Validators.stringToDate(dateFormat))
.convert(Converters.stringToDate(dateFormat))
.validate(Validators.lessEqual(now))
);

We usually leave out the validations in the model-to-UI bindings. It's usually only important to apply validations when you're copying data back from the UI to the model, to make sure domain constraints are satisfied, such as ensuring that a birth date occurred in the past.

And now for my favorite part: binding from multiple sources, to multiple destinations. Raise your hand if you have ever had to wire up a UI form like this:

  Is there a foo? (o) Yes  ( ) No <-- fooRadioGroup

Enter bar: ____________________ <-- barText

Requirements:

  1. fooRadioGroup.selectedItem is bound to model.foo (a boolean)
  2. barText.text is bound to model.bar (a string)
  3. barText must be enabled iff fooRadioGroup selection is Yes.
  4. When the user clicks "No," set model.bar to null but do not clear the text box. If the user clicks "Yes" again, set model.bar back to the contents of barText

Requirements 1 and 3 are easy:

  var fooLock:Lock = new Lock();
Bind.twoWay(
Bind.from(model, "foo"),
Bind.from(fooRadioGroup, "selectedItem"),
fooLock); // explicitly provide the lock, see more below

Bind.from(fooRadioGroup, "selectedItem")
.to(barText, "enabled");

Requirements 2 and 4 are kind of related to eachother. The model-to-UI binding is simple enough: just write the value straight across:

  var barLock:Lock = new Lock();
Bind.from(model, "bar")
.lock(barLock)
.to(barText, "text");

However the inverse binding (UI-to-model) must also take fooRadioGroup.selectedItem into account to decide whether to write back barText.text (if Yes is selected) or null (if No is selected).

The Bind class has another trick up its sleeve:

  Bind.fromAll(

Bind.from(fooRadioGroup, "selectedItem")
.lock(fooLock),

Bind.from(barText, "text")

)
.lock(barLock)
.convert(function(foo:Boolean, bar:String):String {
return foo ? bar : null;
})
.to(model, "bar");

Look closely. The binding pipelines that we pass to fromAll(...) become the arguments, in the order they are provided, to the converter and validator functions further down the pipeline. The first pipeline is from fooRadioGroup.selectedItem and therefore that boolean value is the first argument to the converter. Likewise, the barText.text pipeline is provided second, so that string value becomes the second argument to the converter.

The converter takes multiple values but returns only a single value. This is where those values get coalesced into a single value that we can write to the model--in this case, a String value or null.

The outer pipeline adds a locking step on barLock, which is expected since we need to prevent infinite loops between the last two pipelines. However we are also locking on fooLock, on the first of the inner pipelines. We had a problem with our bindings overwriting values in the UI depending on the order things were initialized.

It turned out that without that lock, if a new model object was set, then the foo binding would fire first. Thus model.foo was copied to fooRadioGroup.selectedItem. But that would trigger our last binding to execute, so if the new foo value was false, then the last binding would override anything in the text box and set null on the model.bar field, before the model.bar => barText.text binding had a chance to execute!

A good rule of thumb is that any time you need to bind from multiple sources, you should make sure to create a lock to share between all the bindings to relate to the same field in the model.

Obviously there are several concepts that will have to be adapted to work elegantly with our existing APIs. Realms are a missing piece (Flex is single-threaded so we didn't even have to consider it). Also we would want to try to retrofit the existing binding classes to use this new API transparently, like we did with the transition from custom observables to custom properties.

So there you have it. This is my current vision of what Eclipse Data Binding should evolve toward.

Comments?

Ian Bull
Ian Bull

OSGi in Dublin

If anybody is going to be in Dublin next Thursday (Sept 9th), I’ll be talking about OSGi, Software Modularity and Single Sourcing.  Details of the event can be found here. If anybody is going to be in the area, let me know. I’d love to catch up with some Eclipse folks over a few frosty beverages.

Ian Bull
Ian Bull

Help, I’m looking for directions — Eclipse Active Help

I know Eclipse ‘Help’ is not a very exciting topic, but today I found myself working with a little known secret of Help.  Most people know that you can setup context sensitive help (Press F1 and bring up help for the specific workbench part under focus).   However, did you now you do the opposite?  That is, activate code in your RCP application from a link in Help?

Here’s the use case:  Say you have created a chat client built on the Eclipse RCP Platform.  Like any good software engineer, you’ve created extensive help content.  In addition to Instructions, you want to provide links that actually open the dialogs, or perform the actions. Active Help is the solution.

contact Help, Im looking for directions    Eclipse Active Help

In this example, I’ve added a link that opens the “Add Contact” dialog, directly from the “Adding a Contact” Help page.

Doing this is extremely simple too. On the Java side, you simply need to implement the ILiveHelpAction.  Then, on the help side you simply add the following JavaScript to your help contents:

<a href='javascript:liveAction(
	"org.eclipsercp.hyperbola",
	"org.eclipsercp.hyperbola.ActiveHelpOpenDialogAction",
	"")'>Click here for a Message.</a>

The only thing to keep in mind is that the Action is not executed on the UI thread, so you may need to synchronize this yourself.

September 01, 2010

Scott Kellicker
Scott Kellicker

Contributing to JSDT #5: Launching the Product

I’ll continue my instructions regarding how to set up JSDT development infrastructure.

Previously

Now run the product

When I work on Eclipse products, we typically provide a default launch config per product.  Although the nightly build is the ultimate authority of what encompasses the product, these version-controlled launch files provide a good point of comparison developer to developer.

I could not find a public JSDT .launch file under CVS control.

So I looked at the installed JSDT product to create my own.  It’s here if you would like to download it.

Just drop it into an active project in your Eclipse workspace, refresh the project, open ‘Run Configurations” and you should see a “jsdt” run config.

You may want to tweak it a bit and verify that the set of selected plugins is correct.

Then hit Run to see the JSDT.

Disclaimer: I’m not on the JSDT team, so this may not be exactly how they do it. But it’s what I’ve done to get it working.


Ian Skerrett
Ian Skerrett

Tell Us Your Eclipse Story: Win a Pass to JavaOne

Lots of people are doing incredible things with Eclipse. People are building amazing applications that embedded Eclipse technology. Companies have standardized on Eclipse as their development tools platform. Students and researchers are using Eclipse for creating some very cool new technology.

As with any open source community, sharing information is critical to fostering  a healthy and strong community. Sharing how you use Eclipse will help other people realize the full potential of Eclipse technology.  More people using Eclipse technology will lead to more potential contributors, more contributors mean more people working on Eclipse projects.

We want you to share your Eclipse story with the community. I’ve started a wiki page to allow individuals and companies to tell the community how they use Eclipse. Tell us what type of applications you build, what Eclipse technology you use and what you like about Eclipse. You can tell us your personal story or tell us what your company is doing. Just tell us your story.

To encourage early stories, the Eclipse Foundation will raffle off a full pass to the upcoming JavaOne 2010 conference to all who submitted a story. To be included in the raffle you need to submit your story on the wiki by September 9, 2010 at 1:00pmET and send me an e-mail (ian at eclipse dot org)


Chris Aniszczyk
Chris Aniszczyk

AustinJUG and Eclipse 4.0

Last night I had the pleasure to speak at my local AustinJUG.

It was nice to catch up with some local folks and introduce people to some new Eclipse technology. In the end, we kind of got sidetracked and there was some good discussion about source control in the corporate environment versus what is going on in open source communities. Unfortunately, it seems Subversion has a stronghold in a lot of companies still. I hope our work in JGit to make a liberally licensed Git library that runs everywhere will start swaying the tide…

Remy Suen
Remy Suen

OSGi, language packs, and interval notations…

Dunge: Hello there, sorry for the noob question. I installed Eclipse for Java (Helios) and JDK update 21, I’m trying to use the Blackberry SDK but when I install it it say I require org.eclipse.jdt.debug [3.5.0,3.6.0) first. I tried to find it in “install new software” or on the website, I can’t find anything
rcjsuen: Dunge: That BB plug-in wants Galileo not Helios.
rcjsuen: “require org.eclipse.jdt.debug [3.5.0,3.6.0)”
rcjsuen: Dunge: 3.5.x corresponds to Galileo, 3.6.x corresponds to Helios
Dunge: rcjsuen : you say 3.6.x for Helios, and they actually write 3.6.0 in the required message, so why should I revert to 3.5.0?
rcjsuen: Dunge: You must not have taken Calculus, or forgot about it.
rcjsuen: [x,y) means x inclusive, y exclusive
rcjsuen: i.e. 3.5.0 <= x < 3.6.0
Dunge: should be [x,y[
rcjsuen: Dunge: I’ve never seen that notation. Where do they do that?
Dunge: I just though it was a typo
Dunge: hmm in my math classes? :)
rcjsuen: [x,y[?
Dunge: yeah
rcjsuen: Dunge: And where do you live? That’s what I meant. :)
Dunge: lol
rcjsuen: Dunge: I am interested in where they use this notation, hence I asked.
Dunge: I just asked the guy next to me and he’s saying it should be a [ too
Dunge: I’m in Quebec
rcjsuen: ah
rcjsuen: in the States they used this
rcjsuen: and I went to U Waterloo, we used that there too
Dunge: but I though it was a global notation
rcjsuen: I shall ask other ppl when I get back to Ottawa on Sunday :)
rcjsuen: Maybe that is what they use in France/Europe?
njbartlett: rcjsuen: Possibly France, but certainly not other bits of Europe
rcjsuen: That notation seems to be part of the ISO anyway http://en.wikipedia.org/wiki/ISO_31-11#Sets
rcjsuen: Very interesting. You learn something new every day as I always say. :)
njbartlett: Indeed, very interesting.
rcjsuen: njbartlett: So I think we need language packs for fr_FR that uses different notation. :)
njbartlett: I’ve given talks about OSGi in lots of countries, almost everywhere there’s at least one or two maths geeks who nods quietly when they see [,)
rcjsuen: hahahaha

Madhu Samuel
Madhu Samuel

BIRT 2.6 Data Analysis and Reporting


Packt Publishing, a UK based book publishing firm has send me a copy of their latest book BIRT 2.6 Data Analysis and Reporting by John Ward to write a review. You can find the details of the book here. I hope to publish an in-depth review about this book in a few weeks at  "I Like Eclipse", the blog site of EclipseBible.com.

madhu

Jonas Helming
Jonas Helming

EMFStore Project approved

We are happy to announce that the EMFStore project has been accepted as an Eclipse Project.
www.emfstore.org

Jonas Helming
Jonas Helming

EMF Client Platform project approved

We are happy to announce that the EMF Client Platform project has been accepted as an Eclipse Project.
www.emfcp.org

Karl Beecher
Karl Beecher

We Have a Winner

Eclipse logoNot many votes (about 20 or so at time of reading), but Google App Engine seems to be a big favourite for Eclipse users, gathering half the votes by itself.

Looks like I have some reading up on Google App Engine to do…


Ed Burnette
Ed Burnette

How to build the perfect Android tablet, part 3: Market watch


Continuing our series on the perfect Android tablet ™, this latest entry is about software instead of hardware. Software applications will either make your tablet into a useful addition to your digital life, or an expensive ingredient in some eco-unfriendly compost pile. Finding the right software is crucial, and for that reason the number three feature on the perfect tablet is:

#3: Full Google software suite including the Android Market

Many recently announced Android tablets come with an alternative application stores such as AppsLib, GetJar, SlideME, or AndAppStore. Alternate markets are good to have for applications that are not allowed, for one reason or another, on Google’s mainstream Android capital-M Market. However, it’s the Market that has 100K+ applications and it’s the Market that is both the de facto and de jure center of the Android development universe.

For a one-time fee of $25, developers can get a publisher’s account on the Market and upload their free or paid applications. The Market is fraught with problems, such as tons of spam, a stingy 325-character limit on descriptions, and a woefully lacking list of supported countries. Google has been ever-so-slowly improving the Market over the last couple of years, for example by adding the amazingly innovative ability to post screenshots (insert sarcasm here). The fact that it’s flawed, though, doesn’t change the crucially important role of the Market in the Android ecosystem.

As a developer, I want to submit my application to one place and have it reach all users. I can do that with the iPhone, so why not on Android? (Of course Apple brooks no alternatives on the iPhone, so it’s not a fair comparison, but still there should be a default market that covers everyone.) Each additional place I have to publish is another place I have to make a publishing agreement with, keep up to date for each upgrade, and manage for marketing. More potential users with less friction for the developer equals more income and more interest in creating exciting games and applications.

Perhaps the greatest impediment to the universal Market is a somewhat nebulous list of restrictions and requirements that Google imposes which limits what types of devices can and can’t have the Market and other Google apps. Some of the restrictions I can understand, like requiring an accelerometer. Others make no sense, such as the need to include a telephone (with its requisite expensive monthly fee). Google needs to change these rules ASAP or at least show some flexibility to accommodate devices (such as as the 5 announced this week from Archos) that aren’t smartphones.

Along with the Market, the perfect tablet should have all the other parts of Google’s Android suite, including GMail, Maps, Navigation, Search, and so forth. The apps should either be pre-installed or available for download through the Market. This does not preclude a vendor from using, say, Bing search and Yahoo Mail by default to differentiate their offering. But Google’s suite is pretty good, and I ought to be able to use it if I want without having to search the fine print for the words, “with Google”.

What would you build into *your* perfect Android tablet? Share your thoughts in the comment area below. And check back next week to find out what’s next on my list.

Scott Kellicker
Scott Kellicker

Contributing to JSDT #4 : Launching the unit tests

I’ll continue my instructions regarding how to set up JSDT development infrastructure.

Previously

Run the unit tests

Now I want to verify that the unit tests for JSDT pass.  (TDD — we should launch the tests before the product, right?)

Nitin Dahyabhai, the JSDT lead, pointed out that the first project above, contains a launch config to run all of the JSDT unit tests.

I will need to check out these additional projects from the webtools CVS repository.

  • org.eclipse.jsdt/development/org.eclipse.wst.jsdt.unittests
  • sourceediting/tests/org.eclipse.wst.jsdt.web.core.tests
  • sourceediting/tests/org.eclipse.wst.jsdt.web.ui.tests


The checked in launch config makes running easy.  Open Run Configurations – select JSDT Tests.  Hit Run.  They all pass, so I see green:

Next: Launching the Product

Disclaimer: I’m not on the JSDT team, so this may not be exactly how they do it. But it’s what I’ve done to get it working.


August 31, 2010

Scott Kellicker
Scott Kellicker

Contributing to JSDT #3 : Build Targets on the bleeding edge

I’ve been documenting how to use JSDT to do some HTML5/CSS/JavaScript development. In order to poke around the JSDT code to understand it better, I spent a bit of time figuring out how to get things checked out, built and running. The instructions on the JSDT site a re a bit sparse, so I thought I would document what I did.

I’m not on the JSDT team, so this may not be exactly how they do it. But it works for me.

Previously

My code no longer compiles!

This morning, I updated all the code I previously checked out.  And now my rhino.ui project has a compilation error in RhinoTabGroup:

After a little investigation, I determined that RhinoTabGroup is using a new 3.7 method in AbstractLaunchConfigurationTab.  It has just been introduced.  I’m building against Eclipse 3.6, so don’t have this method.

So if I want to keep my JSDT source code in sync with the latest, I’ll have to also keep up with any dependencies.

One idea to resolve this would be to download the latest milestone builds and put them in my build target.  However, this change is very recent and is not in a milestone build yet.

Another idea is to check out the latest o.e.debug.ui project and any dependency projects (hopefully not too many).

Check out more projects

To add the eclipse CVS repo, copy this into the CVS Repositories View:

:pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse

And check out org.eclipse.debug.ui and org.eclipse.debug.core projects

And the compilation issue is resolved.

Going Forward

Going forward, my build target and workspace projects will change often.  I’ll need to actively modify these to keep things rolling along.  I’ll be doing a combination of:

  1. Including other Eclipse projects in my workspace, on an as-needed basis.  I’ll start getting a good sense of what these projects are as things break.
  2. Change my build target to move up to Milestone builds.

Next: Launching the JSDT Unit Tests


Konstantin Komissarchik
Konstantin Komissarchik

Inconvenient process? Let’s fix it.

Some of you may have noticed the debate happening regarding proper entry expectations for WTP incubator project following Holger’s veto of a committer election. Holger is acting well within the power granted to him by Eclipse Development Process (EDP), but is it a right and proper action?

Every committer on a project has the veto power in an election. By extension, any entry criteria for a project (whether written or unwritten) is nothing more than a social convention. The reality is that every committer can choose to levy their own personal expectations. Most of the time it’s not a problem, except when it is.

Here are some quotes from this particular event:

“I found only some bug reports but not a single code contribution from any of the four nominated persons. Please attach the planned code contribution to a bug report. I'd like to vote for each of the nominated persons as soon as I know that the code is readable and covered by JUnit tests.”

“Have [snip] been asked if they like to become committers as individuals (and not only as employees of SAP)? Are these authors of the code or what is their motivation to maintain and enhance these editors?”

In a regular project with established code base, established team and well-defined scope, you can argue that giving every committer veto power over elections is appropriate. After all, there is an established code base to protect. The same considerations do not apply when a new component is proposed in an incubator.

The WTP incubator project was started with the intention to provide a low entry barrier playground for people to come and experiment on new ideas while gaining experience and proving their merit to committers on the core projects that will eventually be asked to admit matured functions. Incubators make sense because they provide a quicker way to get started than a separate project proposal. Unfortunately incubators have to rely on a social convention that existing committers act in a welcoming fashion to newcomers. Most of the time that happens, except when it doesn’t.

I would posit that there is no legitimate purpose served by holding a committer election when a new component is proposed for an incubator. The situation is supposed to be very similar to new project creation and we don’t hold elections there. The party proposing a project gets to designate a group of individuals to be the initial committers without anyone questioning their credentials or motives. A similar process is needed to make incubators work better.

The last revision of EDP has formalized the concept of a persistent incubator. I propose that we build on those revisions and amend EDP to remove the committer vote requirement for incubator projects when a new component is being proposed. The project’s PMC would still have the oversight and ability to decline a new component proposal. This change would also fix the rather awkward problem of having to have “seeder” committers when creating incubator projects.

Note that my suggestion is for persistent incubator projects rather than normal projects during incubation phase. I am also not suggesting that we remove committer vote entirely from incubators. Anyone wishing to join existing effort already underway in the incubator should still be subject to committer vote.

Thoughts?

PS.1 : This situation has served to highlight a process problem and it is the process that I seek to improve. I have no beef with Holger. I am sure he is acting on what he believes in.

PS.2 : I am further confident that this particular storm will blow over, Holger’s objections will be met, another election held, etc. That doesn’t mean we shouldn’t try to improve the process so that such situations do not happen again and we continue to have vibrant incubator projects at Eclipse.

Update: At Wayne’s request I created a bug to track this proposed improvement to Eclipse Development Process.

Ian Skerrett
Ian Skerrett

Wrap-up of Eclipse Day at the Googleplex

Last Thursday, Google was the host of the third Eclipse Day at the Googleplex.  I look forward to this event each year and this year was another success.  Over 150 people attended the day long event that included 12 sessions related to Eclipse and Google technology.   The presentations are now available online.   There was lots of great information presented, like upcoming improvements to the Android SDK (based on Eclipse), Git support in Eclipse, a review of the Instantiations tools that Google just purchased and an introduction to the new Tools for Mobile Web project.
The event also included our first ever Eclipse Ignite session.  We had 9 speakers, each speaker had 5 minutes and 20 slides but the slides changed automatically every 15 seconds.  The speakers did a great job and lots of people really enjoyed the format.  Something to certainly try again.

A special thanks to the Google Open Source Program Office for their sponsorship of the event.  These face to face events are really important to building the Eclipse community, so it is great to have Google’s support to make this event possible.


Max Rydahl Andersen
Max Rydahl Andersen

Webinar tomorrow, Clouds and bringing life back to BPEL

The final re-post to remind you to use the feeds from JBoss Tools to get JBoss tooling news ;)

Blogging about upcoming webinar tomorrow, the Cloud efforts and bringng back life to a BPEL project.

See it at JBoss Tools Blog

Mickael Istria
Mickael Istria

How target platforms helped me to fix old bugs

I’ve used target platforms to ensure that I only add dependencies that are available in our build platform. Until now, I found them useful, but I did not understand how powerful they really are. Here is a story that convinced me that target platforms are a master feature of RCP development.

A few days ago, I had to fix a bug on the 5.2.3 branch version of the Studio/RCP part of Bonita Open Solution. The classes I needed to modify had been strongly refactored in trunk (5.3), so that the fix would be different on the trunk than on the branch, and it was impossible to simply propagate a fix.

So I had to edit old code. But my workspace only contained trunk code, and the old code was not compiling because of several refactorings. I was wondering how the heck I would be able to easily work on code from the past…!
But I found an answer and it’s simple… TARGET PLATFORMS !

Here is what I suggest to isolate the branch fix from trunk development:

  1. Create a new workspace (workspaceBranch).
  2. Set the old version of your product (here the 5.2.2 version) as the target platform. This must be the version containing the bug.

    The target platform is made up of all bundles of the product containing the bug

  3. Check out ONLY your old bugged bundle from the branch.

    A minimal and easy-to-use workspace

  4. Create your launch configuration which is made up of the product and your buggy bundle project from workspace.

    Configure your launch to use your product, with the patched bundle from your workspace

  5. Run and test your product to see the bug.
  6. Fix your old code.
  7. Test your fix.
  8. Commit your fix on the branch.

With this trick, I avoided the headaches of mixing trunk and branch code. It made my work much easier and less risky.

The only annoying thing is that you lose all your workspace preferences and Mylyn contexts during the time it takes to finish the fix, so this is not critical.

I can now say it: I ♥ target platforms!

Dariusz Luksza
Dariusz Luksza

Merge support in JGit/EGit 0.9

According to this post of Christian Halstrick and those two commits: 1 2. The upcoming version of JGit and EGit would have merge support! The previous stable version (0.8) had only support for fast-forward merge; all non fast-forward merges must be done using CGit, now all kinds of merge can be done using EGit UI.

The 0.9 version would have more cool features eg. History view improvements, branch and tag dialog improvements and (of course) support for Synchronize view. Say tuned for a full list of new and noteworthy that will be published in upcoming days.

Matthias Sohn
Matthias Sohn

First EGit content merge with new resolve merge strategy

Just tried the brand-new resolve merge strategy Christian Halstrick worked on hard in the last months which finally got submitted today after months of testing, reviewing and refining the implementation.

I created a simple test project and changed a simple class in two different ways on the branches “first” and “second”. Then I successfully fast-forward merged branch “second” into branch “master”. Then I hit “Team > Merge” to run the shiny new resolve merge strategy to merge branch “first” into “master”. And here we go: the merge tried to merge the content and detected the conflict:

EGit resolve merge with conflict

EGit resolve merge with conflict

Give it a try and let us know if you hit any problems, we will work on improving the user interface
and of course also plan to integrate it with a visual merge view.

August 30, 2010

Eclipse Announcements
Eclipse Announcements

Register for the Eclipse Fall Training Series

The Eclipse Foundation and Eclipse member companies are pleased to announce the fall 2010 training class series. The training is an excellent opportunity for software developers and architects to learn more about Eclipse Rich Client Platform (RCP), BIRT and Modeling technologies. Eclipse experts will lead the sessions, providing practical experience through classroom instruction and hands-on labs. Virtual and on-site classes have been scheduled in several countries from September 20 to November 5, 2010.

Andrew Eisenberg
Andrew Eisenberg

Debuggable GSPs in SpringSource Tool Suite


A basic trick of Groovy Server Page debugging that seasoned Grails developers know is that by adding ?showSource=true to a URL for any of your GSPs you can view the Groovy translation of your GSP code.  For example, the vanilla create GSP (http://localhost:8080/TripPlanner/trip/create.gsp) gets rendered like this in the browser:


And altering the URL to this: http://localhost:8080/TripPlanner/trip/create.gsp?showSource=true, you can see the translated source:


There is a mapping between lines of code of the original GSP and the lines of code of the Groovy translation.  In fact, if you are using Grails 1.3.4 or above, and scroll to the bottom of the translation, you will see something like this:


 82: @org.codehaus.groovy.grails.web.transform.LineNumber(
  83: lines = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 11, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 17, 17, 18, 18, 19, 19, 20, 21, 23, 23, 23, 23, 25, 25, 26, 35, 35, 35, 35, 37, 37, 37, 39, 39, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  84: sourceName = "create.gsp"
  85: )
  86: class ___LineNumberPlaceholder { }


This is the line mapping information and each element of the lines array maps a line from the translation (the array index) to a line in the original source code (the value at that index).  This is not particularly useful to humans, but it is to the SpringSource Tool Suite.

Using this information, STS is finally able to provide some debugging support for GSP files.  You can set a breakpoint at a line in your GSP editor, and the debugger will pause at that line when it is reached while rendering the page:



At this point, your GSP can be interacted with like any Groovy file.  For example, you can inspect the current state of variables in your page binding:



And you can execute values in the display view (using Java syntax only for now):



This feature has been fun to implement since it was my first foray into Eclipse's Java debug interface, but I am not sure how useful it is going to be.  Lines in a GSP are not executed sequentially.  Rather, many are executed out of order through closures inside of an invokeTag method call.  Also, I have not completely worked out how to determine if a breakpoint is at a valid location if Grails is not already running.  So, at this point it is possible to set a breakpoint on any blank line, but these breakpoints are only valid if they are set on a line containing a GSP tag or some other kinds of things.

But, I do hope this is useful to you and if you are interested in trying this new feature out, then you can download STS 2.5.0M3 and install the latest version of Grails tool support.  Enjoy!

Lars Vogel
Lars Vogel

The JUG which lives – EGit presentation on 02.Sept. at the Majug

Since beginning of last year I participate more or less actively in the Java User Group Mannheim. Unfortunately the former main contact of the Java User Group Mannheim Alex Hanschke has moved out of the area.

Benjamin Muskalla and myself volunteered to help organize the JUG Events. Therefore Benny and I will as of now try to find great new speakers and setup cool events. I think we are starting very well, as we are proud to have Matthias Sohn and Stefan Lay speak about Git and EGit on the 02.Sept. Git is one of the leading distributed version control systems and EGit a team provider for Eclipse.

Matthias and and Stefan are both committers in the EGit project. Details on Matthias and Stefan and the presentation can be found on the Majug Event Announcement. As usual we organize to have drinks after the event and hope Matthias and Stefan will be able to join so that you can bugger them with questions. The presentation will be in German.

Rumors are that we will see a real merge via EGit on this event:-) Hope to see you at their.

 

BioClipse
BioClipse

Bioclipse 2.4.1 now on update site

A new version can be found on the update site. The new versions of the features contain the latest fixes. New in this version is support for Jasper reports which are so far used by Bioclipse Decision Support and Bioclipse Brunn for generating printable reports.

To update go to Help -> Software Updates... and select the features you want to install.

Known problem: The splash screen erroneously shows version number to be 2.4.0 after update. (Technical information can be found at bug: 2084 in our Bugzilla)

Karl Beecher
Karl Beecher

Poll: Your favourite web application hosts/technology when using Eclipse

Eclipse logoI’m embarking on a pet project, in short: a Python-based web application using my favourite editor, Eclipse. Being quite new to this, I thought I would poll my readers, especially those Eclipse web app developers among you, for their opinions on the best solutions. I realise I’m giving very few details, but I simply want to know what’s popular, or even what is being used that I’m not aware of. Thanks.

<noscript> <a href="http://answers.polldaddy.com/poll/3689275/">View This Poll</a><br /><span style="font-size: 10px;"><a href="http://polldaddy.com/features-surveys/">online survey</a></span> </noscript>

Neil Bartlett
Neil Bartlett

OSGi Readiness — Loading Classes

In my previous post on “OSGi Compliance”, I discussed the idea of making libraries ready for OSGi without depending on OSGi directly. In light of BJ’s comment I will refer from now on to OSGi “Readiness” rather than Compliance, as the latter term is easily confused with the concept of a framework implementation that complies with the OSGi specification.

In each of these blog posts, I will state a requirement and then look at options for satisfying that requirement in an OSGi Ready way.

Problem Statement

You are developing a Java library, “Framework X”. Occasionally you must load and instantiate a class dynamically by name, where the name may originate from a configuration file or be passed into the framework as a parameter to an API call. You would like the framework to work cleanly both in OSGi and other environments, i.e. there must be no dependency on OSGi.

For example, suppose we are implementing an O/R mapping framework similar to Hibernate, and the user has supplied a configuration file such as the following:

<or-mapping>
   <class name="org.example.domain.Event" table="EVENTS">
      <id name="id" column="EVENT_ID"/>
   </class>
</or-mapping>

This tells our framework to create an instance of org.example.domain.Event for each row of the EVENTS table. Therefore we must dynamically load and instantiate the org.example.domain.Event class.

Discussion

To dynamically load a class in Java we require two things: the fully qualified name of the class, and a ClassLoader from which to request it. If we have both of these then we can trivially load a class irrespective of whether we are in OSGi or not.

To reiterate: OSGi does not interfere with the standard Java class loading API. If we have the fully qualified name of a class and a ClassLoader that knows of that class, then we can always load and instantiate the class.

Problems arise only when we do not know the correct ClassLoader, and make the wrong guess about which one to use.

First Wrong Guess: Class.forName()

Java provides us with a way to load a class without explicitly specifying a ClassLoader, using the single-argument version of the Class.forName() method:

Class clazz = Class.forName("org.example.domain.Event");

Since we don’t specify a ClassLoader, this method uses the loader that loaded the class in which the line of code appears. In other words, it uses the same loader that loaded the framework. In a traditional Java SE environment this usually works just fine, because both the framework and domain classes are probably installed as JARs on the classpath, and the classpath is loaded by a single ClassLoader, the so-called “system” loader.

But in OSGi, the domain classes are likely to be supplied in a different bundle, because there is a clear modular separation between the O/R framework code and the domain model classes, and therefore they will be loaded by a different ClassLoader. We can still make it work if the package org.example.domain is listed as an import of the framework bundle like so:

Import-Package: org.example.domain, ...

However this is unsatisfactory because Import-Package is statically defined, and a general-purpose O/R framework does not know in advance which domain packages it will need to import.

(NB there are a couple of other workarounds for this problem in the case that the framework code cannot be changed. These include: DynamicImport-Package; shipping the domain classes as a fragment hosted by the O/R framework; and using the Equinox-only “buddy loading” feature. However all of these workarounds have their own severe problems, which I shall not discuss in depth here because the purpose of the post is to document how to best implement a framework such that hackish workarounds are not required.)

Second Wrong Guess: Thread Context Class Loader

The Class.forName() approach fails not only in OSGi but also in other environments such as Java Enterprise Edition, for similar reasons. Because of this, another common pattern is to use the Thread Context Class Loader (TCCL), which was introduced relatively recently (i.e. Java 1.2):

ClassLoader tccl = Thread.currentThread().getContextClassLoader();
Class clazz = Class.forName("org.example.domain.Event", true, tccl);

Some libraries use the TCCL exclusively, others use it as a last resort after failing to load from other candidate class loaders. Almost every library follows a different strategy because Java has provided almost no specification or guidance on when to use the TCCL… to quote a classic JavaWorld article:

Those class and resource loading strategies must be the most poorly documented and least specified area of J2SE.

Even in J(2)EE the specifications do not lay out precisely which set of classes should be visible through the TCCL. In practice, a J(2)EE application server is able to provide a sensible set of classes via the TCCL because the programming model is highly constrained: each application runs in an isolated silo, is not allowed directly to create threads or network sockets, and threads cannot cross application boundaries. Because it controls all the entry points, the application server can provide a TCCL that is appropriate for the running code.

OSGi’s programming model is far less constrained. Bundles are free to create threads, to open network sockets, and to call APIs exposed by any other bundle. There is no way in Java to intercept a direct method call that happens to cross a bundle boundary, so the OSGi framework cannot ensure the TCCL is relevant to the current code. As a result, the TCCL is not defined by the OSGi specification, and it may be null. Therefore, we cannot rely on the TCCL for anything.

Solutions

Now let’s discuss possible solutions. To be clear, all of the following suggestions are intended to supplement rather than replace existing approaches. If your framework is working in J2SE/J2EE with Class.forName() or TCCLs then you should continue to use those approaches. But, please provide additional options for runtime environments such as OSGi where those approaches fail.

If you feel these suggestions are trivial or obvious — that is exactly the point. There is nothing complicated about making frameworks that work well in OSGi. Indeed, you may find you prefer using one of these patterns as they reduce the complexity and testing burden of your code.

Option 1 — Instance Factory

The first option is to avoid dynamic by-name class loading altogether. Although not always practical, it may be possible in some cases to allow clients to supply their own callback or factory to create objects as required.

For example our O/R mapper could define the following interface:

public interface DomainObjectFactory {
    Object createInstance(String tableName);
}

Clients could supply an instance of this factory when initialising a session, or we could wire it in with our favourite Dependency Injector. This has the advantage that clients can construct objects however they like, rather than placing restrictions on the permitted constructors in the domain classes.

On the other hand it may be risky since a client factory implementation could return shared instances, whereas the framework expects new objects on each call to createInstance(). So long as such requirements are documented, the framework should permit clients to do what they like.

Option 2 — Register Classes

Another option is to add API for clients to register loaded classes in advance. This is best illustrated in client code:

session.registerClassForTable("EVENTS", Event.class);
List events = session.createQuery("from Event").list();

Here the client code has direct visibility of the Event domain class, so it can use a class-literal to pass a Class to the framework API. The framework can now use the supplied class whenever it reads from the EVENTS table.

We can even register classes directly against their names:

session.registerClass("org.example.domain.Person", Person.class);

The framework can use the registered class whenever it needs to create an instance of org.example.domain.Person, but fall back on Class.forName()/TCCL for unregistered names. No other changes are required in the framework.

Note that with this option, the client loses some flexibility and control. By passing a class rather than instances, the client has no opportunity to construct objects in the way it wants them, but instead relies on the framework to construct them.

This is not so bad in the running example of domain objects, but suppose we are talking about some kind of “service” object. Without control over instantiation, clients cannot make the service aware of its “environment” or “context”. Sometimes this forces us to use static fields, thread-local variables or other hack to get hold of our “context” after having been instantiated by a framework.

If the framework allows pre-instantiated objects, then those objects can be pulled out of the OSGi service registry, a Dependency Injection container, or even generated on the fly. So when designing an API, please consider whether the framework really needs to take control of instantiation by requiring Class objects — if not, at least allow the option of passing pre-instantiated objects.

Option 3 — Pass the Loader

This option is the conceptually the simplest, and also has the least impact on existing code: allow clients to pass a ClassLoader into your API. The appropriate time to do this is highly dependent on the nature of the API, but in the O/R mapper it might be done during initialisation of a session:

SessionFactory.createSession(MyClass.class.getClassLoader());
// ... OR ...
session.setDomainClassLoader(MyClass.class.getClassLoader());

To minimise the impact on existing code, this method can be overloaded with another version that takes no argument. Alternatively, clients could pass null to indicate that the framework should attempt to find the right ClassLoader.

Again there is a loss of flexibility for clients since this solution assumes all classes can be loaded from one class loader, which may not actually be the case, but in practice it doesn’t create any real problems.

Summary

Although this post has been rather long-winded, the message is very simple: stop guessing.

If you are writing a library that performs dynamic by-name class loading, do not make assumptions about which ClassLoader to use. Allow client code to specify a class loader, or perform its own class loading. By all means retain your Class.forName() or TCCL-based lookups, but please provide an override for environments in which they will not work.

Fabian Steeg
Fabian Steeg

Scala, object persistence, and the original NoSQL: XML

In our digitization wiki project based on Eclipse 4 and Scala it was time to find a persistence solution. As a quick overview of what it’s about, our app will basically allow a user to edit a digitized book page, showing the original scan as an image, with the selected word highlighted. It currently looks like this:

A digitization wiki using Scala and Eclipse 4

For the initial prototype implementation, we used XML files in zips to store the page content, combined with TrueZIP, a library which allows access to files in zips the way it should be: like files in a folder. So we could basically create and use the zip entries like this:

val zipEntry = new File("PPN345572629_0004.zip/0001.xml")

The XML is created using Scala’s XML support, e.g. the top class in our domain model (Page) is serialized by specifying the root element and calling toXml on each containing element (the words), like this:

def toXml:Elem = <page> { words.map(_.toXml) } </page>

The XML is deserialized with the reverse action, by passing the deserialized word elements contained in the root element to the Page factory method:

def fromXml(page:Elem) = Page( for(word <- (page \ "word"))
  yield Word.fromXml(word) )

So that was basically our prototypical persistence mechanism. Of course, to actually collaboratively correct our digitized texts, we needed a central DB instance on some server. Or maybe not exactly: having heard good things about CouchDB (in german), it was the first option I looked into. The distributed nature of CouchDB sounded very interesting and seemed appropriate for our project – not for performance reasons, but to provide offline or decentralized editing as an option.

So I looked into CouchDB with scouchdb, a Scala API to access it (and a very welcoming project). After input from my colleague, I became aware that we’d lose quite a bit of installation ease if we pick a non-Java DB, so CouchDB was not really a client side option for offline storage, and therefore the strongest reason for us to consider it no longer there.

Next I considered an embedded relational Java DB with some ORM or ORM-like access. A JPA solution like EclipseLink or Hibernate seemed overkill and not ideal for Scala. Instead I took a closer look at ScalaQuery, which uses Scala’s for expressions for DB queries, which seems like the thing you want if you happen to use a language that basically has a query language built-in.

For instance, in ScalaQuery, we could write a query to get all pairs of pages and words where the page contains the word and the original form of the word is Bonifaci like this:

val bonifaci = for (page <- Pages; word <- Words;
  if page.id === word.pageId && word.original === "Bonifaci")
  yield (page, word)

To allow this kind of queries, we need to define tables named Pages and Words. Defining the tables with ScalaQuery is quite elegant, e.g. our main table for pages could be defined like this:

object Pages extends Table[(String, java.sql.Blob)]("pages") {
  def id = column[String]("id", O PrimaryKey)
  def image = column[java.sql.Blob]("image")
  def * = id ~ image
}

However, this leads to either a duplication of our domain objects (have a table object as above and the original class) or a complete rewrite (use table objects like above as the domain objects), which both seemed wrong.

Also, thinking about alternatives to our XML representation, I came to realize that we would want some form of XML export anyway to ensure long-term access to our data, which is in the public domain and a cultural asset. Of course it would be possible to implement this as some form of export, but if possible it would be just perfect if we could use a single persistence mechanism.

I did remember there are some XML DBs around, but initially abandoned that idea since XML is only half of what we store (the other thing being the images used to correct the text, see screenshot above). But after being unhappy with these other solutions, I took a closer look at eXist-db, an XML DB licensed under the LGPL which by default runs on Jetty.

And I learned that eXist actually supports both XML and binary data, which was just what we needed. With eXist, we also get XQuery support and various interfaces to the data. In our case, this is less of an immediate concern, given Scala’s XML support and for expressions are a bit like built-in XQuery capabilities. For instance, a query on XML that is equivalent to the ScalaQuery from above could look like this:

val bonifaci = for (page <- xml\"page"; word <- page\"word";
  if (word\"@original").text == "Bonifaci") yield (page, word)

This is not only about as concise as the query above, but also allows to express the hierarchical nature of our data in the query (‘each word in the page’), instead of having to map the relational representation (‘all words with a certain page ID’).

As we already deserialize the XML to page objects, what we actually do is query on these. For switching the serialization from entries in a zip file to the eXist DB and allow these queries, the only conceptual change was to store the XML and image files in the DB instead of using a File object, which allowed a really smooth transition.

And with Scala’s rich semantics and XML support, our DB wrapper in Scala can be very simple and precise about what it offers in its API, namely XML documents for a collection ID (if found in the DB):

val xmls:Option[List[Elem]] = Db.xml(collection)

Or binary data:

val imgs:Option[List[Array[Byte]]] = Db.bin(collection)

The elements provided by the DB in this way can be passed to the original deserialization method of Page:

val pages:List[Page] = for(page <- Db.xml(collection))
  yield Page.fromXml(page)

Given this, we can now use a plain Scala for expression on the deserialized objects to query our data like this:

val bonifaci = for (page <- pages; word <- page.words;
  if word.original == "Bonifaci") yield (page, word)

At this point we have replaced the file storage with the DB, but are still creating the XML manually, using Scala’s XML literals. To avoid any duplication (each class parameter or field is represented again in the serialization logic), and basically eliminate all direct XML manipulation, we could use an XML binding library like scalaxb, JAXB-RI or MOXy.

On the other hand, the type safety of the Scala XML serialization code makes the duplication feel much less dangerous than traditional, string-based XML serialization (which can break easily unnoticed by the compiler). And being about as concise as some JAXB annotations and marshalling code would be, the disadvantages seem almost entirely theoretical, but we’ll see – swapping the serialization logic should be as easy as swapping the storage implementation was.


August 29, 2010

Carlos Valcarcel
Carlos Valcarcel

Writing an Eclipse Plug-in (Part 24): Common Navigator: Configuring the submenus (Presentation…again)

When we last left our erstwhile travelers (that would be all of you) they were surfing the quantum wave on their way to a future refactoring of their past to allow them to simultaneously feel proud of their work and embarrassed that they were following some guy who is making it all up as he [...]

Andrei Loskutov
Andrei Loskutov

Ping from Ubuntu

There was a long time no update from my side. Mostly because of my new full time project. Another reason was - I've played a bit with different Linux distributions.

Finally I've decided to move to Mint (based on Ubuntu). This is a great distribution which is far easier to manage as Windows XP, even for complete beginners. I've also tried Windows 7, but it was not really better then XP except that it can address now all 8 GB of RAM I have in my PC. From the administration point of view, I found Mint (Ubuntu) much easier.

So why this post? After switching to Ubuntu, first think I've stumbled upon was the HUGE toolbar size used by Eclipse. Horrible. So I had to tweak my GTK themes and also one of my plugins, to get this toolbar's to the proper dimensions. May be more about this later (I've patched one of Murrine themes), but as a result, I've released a new 1.5.6 version of the Extended VS Presentation plugin. Additionally it has a bugfix for the maximize/minimize actions which were not properly working on Linux in some cases.

Enjoy.

Sebastian Zarnekow
Sebastian Zarnekow

Fun with Xtext: Language Mixins

There are rumors that Xtext does only have rudimentary support for language libraries or language reuse and does not allow to create 'advanced stuff'. And it is actually true, that Xtext has only first class support for extending only one other language. But with some creativity and customizing, it is easily possible to create really nice editors for intermixed languages. I've produced a small screencast that demonstrates how an editor for template proposals (read: a template language) may look like when it's aware of your target syntax.



Besides the smart editor for template proposals there is another interesting feature in this screencast: As template proposals are usually edited on a preference page, I implemented a small prototype that shows how a form field may leverage the features of a full blown Xtext editor.

Both prototypic implementations are only based on Xtext 1.0 APIs and not yet publicly available. But I'ld assume that at least parts of them will be moved into the Xtext Indigo stream. Stay tuned!

Stephan Herrmann
Stephan Herrmann

New Refactoring for OT/J: Change Method Signature

IDE Innovation

Every now and then some folks report that the IDE they’re developing now supports this or that cool new feature. Sometimes I envy them for such progress - but more often than not I end up realizing that the OTDT already has that feature or something very similar. Is that just my personal bias (which certainly I have) or are we cheating in some way, or what?

There’s a little detail in the design of the OTDT that turns out to make such a difference as normally can only achieved by cheating: by the way how the OTDT extends and adapts the JDT it is like saying we’re starting the race not at the line saying “START” but at the other one saying “FINISH” and run on from there. While many projects define “JDT-like user experience” as their long-term goal, the OTDT basically has this since the first release. How come? The OTDT basically is the JDT, with adaptations.

There’s a fine point in the word basically. To tell the truth, every feature that the JDT supports for Java development is not automatically fully available in the OTDT for OT/J development. In fact most JDT features need adaptation to provide equal convenience for OT/J development. It’s just that all these adaptations can be brought into the system very very easily - thanks to the self-application of OT/Equinox. And now, here is actually an example of a JDT feature that lacked OT/J support - until yesterday:

Change Method Signature Refactoring

If you refactor mercilessly the “Change Method Signature” refactoring is certainly one of your friends. Add/rename/remove/reshuffle parameters of a method without (too easily) breaking existing code, cool. It knows about the connections from method invocation to method declaration and about overriding. That’s good enough for Java, but not good enough for OT/J since OT/J introduces method bindings (”callout” and “callin”) that create a wiring between methods of different objects. Obviously, if one of the methods being wired changes its signature so must the method binding.

Technically, the JDT implementation of that refactoring bailed out when it asked a parameter/argument for its parent in the AST and found neither a method declaration nor a method invocation. The JDT refactoring does not know about OT/J method bindings, so it just failed to update those.

After a little of coding this is what happens now when you apply “Change Method Signature” on a piece of OT/J code. Assume you have a plain Java class:

public class BaseClass {
	public void bm(int i, boolean b) {
 
	}
	void other() {
		bm(3, false);
	}
}

and a TeamClass whose contained RoleClass is bound to BaseClass:

1
2
3
4
5
6
7
8
9
10
public team class TeamClass {
	protected class RoleClass playedBy BaseClass {
 
		void rm(int i2, boolean b2) <- after void bm(int i, boolean b);
 
		private void rm(int i2, boolean b2) {
			System.out.println((b2?i2:-i2));
		}
	}
}

Here the right-hand side of the callin binding in line 4 refers to the normal method bm(int,boolean) defined in BaseClass.

What happens if you start messing around with the signature of bm?
Like:

Change Singature - Edit Parameters

I.e., we are adding a parameter str and also change the order of parameters (from i,b to b,str,i). I don’t have to tell you what this refactoring does to BaseClass, but here’s the preview of those changes affecting TeamClass:

Change Signature - Preview TeamClass

(sorry the screenshot is a bit wide, you may have to click to really see).

The preview shows that the refactoring will do three things:

  1. Update the right-hand side of the method binding.
  2. Add a parameter mapping (the part starting with “with“) to ensure that the role method rm receives the arguments it needs, the way it needs them.
  3. Do not update any part of the role implementation, because that’s what the parameter mapping is for: shield the role implementation from any outside changes.

Some words on these parameter mappings: each element like “b2 <- b” feeds a value from the right-hand side (representing things at the baseclass side) into the parameter at the left-hand side (representing the role). The list of parameter mappings is not ordered, which means further swapping of base side parameters requires no further action. And indeed the current implementation of the refactoring does not attempt to adjust an existing parameter mapping (which might be a quite complex task). If adjustments are required which the refactoring cannot perform automatically, it will inform the user that perhaps a parameter mapping may need manual adjustment.

The refactoring applies no AI to guess what the intended solution should look like, but it performs a number of obvious adaptations and gives note when these adaptations may not suffice and manual cleanup may be needed.

Implementation

Those who have read previous posts may (almost) know the kind of statistics that follows:

  • 299 LOC implementation
  • 315 LOC testcode
  • 170 LOC testdata

I should really show one of these OT/J based implementation, one of these days. For this post I will just give you an Outline, literally:
Implementation Outline

Role class Processor is bound to the JDT’s ChangeSignatureProcessor, and the nested roles OccurrenceUpdate and MethodSpecUpdate are bound to two inner classes of ChangeSignatureProcessor, which shows how even class nesting at the base level can be mapped to the team & role level. Instances of the innermost roles will only ever come into being, if a Processor role has detected that it needs to work in order to handle OT/J specific code. Inside each role - apart from regular fields and methods - you see those green arrow-things, denoting method bindings between a role and its base. The highlighted binding to createOccurrenceUpdate is actually the initial entry into the logic of this module. Further down you see how the base behavior reshuffleElements is intercepted to additionally add parameter mappings if needed (and yes, I’m hiding the details of role MethodSpecUpdate, but there are no secrets inside, I just more methods and more method bindings).

Voilà, we indeed have a new refactoring for OT/J. I’ve been planning this one for a while but in the end it took me little more than a day :)

August 28, 2010

Karl Beecher
Karl Beecher

New Saros release: 10.8.27

Another month, another Saros release. This time around it consists mostly of bugfixes…

… but be advised. There are now a couple of dozen youngling programmers busying away at Saros code like worker bees for the next few weeks.

Expect a bumper crop of fixes and features in September!


August 27, 2010

Manuel Selva
Manuel Selva

Modify a file in response to IResourceChangeListener

Hi there,

In the context of an IResourceChangeListener I need to modify a given preference file in the workspace.  Because of “Note that during resource change event notification, further changes to resources may be disallowed.” the only solution to perform this change is to delay it on a future event (5 seconds later, on the next access to the file to be modified, on the next selection event, etc ..)

I would be interested to know how do you handle such situation ?


Mariot Chauvin
Mariot Chauvin

Search in eclipse forum

If you would like to search in eclipse forum, here is a quick form which may help you.



Project name:
Your search:




Eclipse Labs - Most Active Project
Eclipse Labs - Most Active Project

Eclipse Labs Projects Update for the week of August 27th 2010

Most Active Projects

code-recommenders - IDE 2.0: Bringing Collective Intelligence into Software Development
anyedittools - AnyEdit plugin adds several new tools to the context menu of text based Eclipse editors, to Eclipse main menu and editor toolbar
birt-functions-lib - A collection of BIRT Aggregate and Script Function Extensions for use in your project
birt-controls-lib - A collection of BIRT ReportItems created through the ReportItem extension point.
wascana - Wascana Eclipse C/C++ IDE for Windows Developers
onotoa - Onotoa is a visual editor for the Topic Maps Constraint Language.
skin4eclipse - Extended VS Presentation plugin contributes Eclipse skin and editing sessions management


New Projects

e-dziennik-inz - Elektroniczny dziennik wspomagania prowadzenia zajęc
mydarkspot - chat
alice7erros - Jogo dos 7 erros para o projeto Alice realizado no colégio NAVE
dreamforce - DreamForce
clubvelicotsw2 - ClubVelico
photoproject - photo print and other apps
twitteclipse - twitter client as eclipse plugin

August 26, 2010

Sven Efftinge
Sven Efftinge

Will talk about Xtext in Antwerp and Stockholm soon.

I have the pleasure to present Xtext in two of the most beautiful european cities within the next two weeks.


Belgian Eclipse Community Meeting (Antwerp)

I'll be in Antwerp next Tuesday and meet up with Belgian's Eclipse Community.
The event is free of charge and the details can be found here. There's also a presentation of EGit, which I'm looking forward to see (I'll have lots of questions :-)).

"Developing Domain-Specific Languages with Xtext" (Stockholm)

A week later on Thursday, the 9th, I'll be in Stockholm. The event is sponsored by Jayway and there will be two presentations. First I'll talk about Xtext and afterwards Patrik Nordwall and Andreas Källberg will present Sculptor, which is an open-source framework/code generator based on textual DSLs implemented in Xtext.

The event is also free of charge. Register here.

EclipseLive
EclipseLive

Reminder - Eclipse Virgo

Glyn Normington (VMware), Steve Powell (VMware)
 
Abstract:

The Eclipse Virgo project provides a modular open source application server based on OSGi. The project is a donation to the Eclipse foundation of the dm Server open source project developed by SpringSource (VMware). Virgo provides a standalone kernel which may be used on its own or configured to create custom server types. Virgo Web Server integrates the Gemini Web container on top of the kernel to support standard WAR files and modular webapps comprising OSGi bundles.

In this webinar, we'll explore the key features of Virgo such as: repositories, deployment plans, regions, Equinox console extensions and administration console. We'll demonstrate the Eclipse-based tooling and the runtime facilities of Virgo. We'll also cover the current status of the project and how you can get involved.

Total running time will be approximately 1 hour

8:00 am PDT / 11:00 am EDT / 3:00 pm UTC / 5:00 pm CEST - Convert to other time zones

Thanks to Adobe for contributing their Adobe Acrobat Connect product to host this webinar.


delicious delicious | digg digg | dzone dzone

Bob Balfe
Bob Balfe

Poll: Do you or your customers develop or use applications on salesforce.com?

I have been checking out developer.force.com this week and it is a pretty extensive cloud based solution for developing, deploying, and using applications in the cloud.  I checked out their Eclipse based development videos and the development environment looks pretty comprehensive.  I would like to hear if anyone who reads this blog has any real experiences they would like to share about it.  I am also interested to hear how many of my readers have real exposure to SalesForce.com.

If you use SalesForce.com in any manner, application use, develop for, deploy on, integrate with or any of the above please take some time to post your answer below and possibly a comment on your experiences.

If you are a Lotus customer I would like to hear how you integrate your XPages, Domino or Notes applications with SalesForce.com.

Thanks in advance!

Note: There is a poll embedded within this post, please visit the site to participate in this post's poll.

Holger Voormann
Holger Voormann

An Inconvenient Process

Today I vetoed the nomination of five potential committers. This is something I really disliked and hated doing but I believe I had to: all five nominated persons have reported a few bugs but have not (yet) contributed a single patch. They have been nominated because the company they work for is going to contribute a cool feature to the WTP Incubator project and these people are supposed to maintain the code. Unfortunately, the contribution is still outstanding and the code is not yet Open Source.

What do you think? Should the Eclipse Process be changed so that everyone who likes to contribute and signs the Member Committer Agreement automatically becomes a committer? We have fewer than 500 about 1,000 [see Wayne’s comment below] Eclipse committers and probably in every Eclipse project there is a need for more contributors and committers. To lower the hurdle of becoming a committer also means lowering the attractiveness of being one of a select group of Eclipse committers and this may have the opposite effect: less instead of more active committers.

Update: After the code had been made public as an attachment in Eclipse Bugzilla I restarted the nomination. The code really looks good and I’m happy that WTP Incubator will grow by an interesting feature and by five committers who deserve this status. Looking back, I think that when a nomination comes along with a contribution we should always demand that the contribution is made public before or at the very beginning of the nomination process (if it is not already Open Source). Unlike me, you should not only ask for it but also veto as soon as possible so that it is clear that this has to be fixed before the nomination ends (you can then change your vote from -1 to +1 or 0).


Lars Vogel
Lars Vogel

Local Mylyn tasks distributed via git

I learned from Steffen Pingel and Ekkehard Gentz that Mylyn has the ability to save local tasks outside the workspace. This is hidden under advanced in the Preferences.

This allows you to put your local tasks outside your workspace and versionize them with git. This way you can use git to move your local tasks between machines. I really like this as I frequently use different machines and now I can not only share source code betwee them but also my mylyn taslks.

As Steffen told me, simultanous access to the Mylyn tasks might cause task corruption but I don’t think that is an issue for me as Git takes care of conflicts and I do not have two machines writing to the same local file.

Fun times with Git and Mylyn!

 

Ed Burnette
Ed Burnette

How to build the perfect Android tablet, part 2: A touch of class


If you could build the perfect Android tablet, what would it look like? That’s the question I asked myself last week when I started this series. The number 1 feature was, well, you can go read about it yourself if you missed it. Now it’s time for the second most important feature:

#2: Capacitive touch screen with smooth 10+ finger multi-touch

Recently I had the distinct displeasure of trying out an el-cheapo Android tablet from Augen that came with a resistive screen and, of all things, a stylus. Don’t let anybody fool you. Resistive screens are bad. Very bad. I’m serious about this. I don’t care how cheap they are — you should avoid them at all costs. Do. Not. Buy.

Now that that’s out of the way, let’s talk about multi-touch. For the first couple of years of Android history, Android phones were single-touch. Point, tap, drag, and that was about it. iPhones supported multi-touch gestures like pinch zoom, and Android fans suffered the indignity of having the competition do something better than their baby. Well, at least Android had cut-n-paste, so there.

About the time iPhone finally got cut-n-paste, Android got multi-touch. Sort of. Unfortunately the first implementation on the Nexus One was pretty bad. Aside from jerky low-res registration of finger movements, it often got the coordinates of tracked fingers confused. Partly this was because of limited digitizer hardware used by HTC, and partly this was because of, ahem, idiosyncrasies in the software stack. You can read more about it in my multi-touch series and in various discussion groups and bug reports.

Anyhoo, newer phones, especially the Droid Sholes and successors from Motorola, included a better digitizer that fixed some, but not all, of the problems. Still, a fundamental issue remains: At its best, all Android devices on the market as I write this are limited to only tracking 2 fingers at once.

So sure, you can do pinch and zoom but you can forget about 3 finger swipes and more elaborate gestures that people have thought up. More importantly, only having 2 fingers rules out a whole class of applications like guitar and piano applications, synth controllers, chorded keyboards, and games that two or more people can play. Especially, say, on a larger screen, like a tablet.

A tablet practically begs for lots of fingers to touch it. I own an iPad, and one of my favorite programs there is called Magic Piano by Sonic Mule. I can use all 10 fingers at once to play any music that I could play on a real piano. Unfortunately, I can’t play a duet with a friend on the same iPad because it maxes out at 10 or 11 fingers. Any more than that, and the touch screen simply doesn’t register the touches.

Are you hearing this, HTC, Motorola, and Notion Ink? Paying attention, Asus and Samsung? To make the perfect tablet, please bring on that silky smooth capacitive goodness with support for *at least* 10 fingers caressing the screen at once, starting at the hardware level and going all the way through the Android software stack. And if you can, make it better than the iPad by supporting more than 10 fingers at once. My fledgling musical career depends on it.

What would you build into *your* perfect Android tablet? Share your thoughts in the comment area below. And check back next week to find out what’s next on my list.

August 25, 2010

Miles Sabin
Miles Sabin

Google Summer of Code 2010 @ Scala IDE

UPDATE: an update site including Jin’s GSoC work is now available.

I was lucky enough to be the mentor on a Scala IDE for Eclipse project which was selected for this year’s Google Summer of Code. Jin Mingjian was the student for this project, and it’s been wonderful to work with him over the last few months.

Jin completed his Doctoral degree at the Institute of Electrical Engineering in the Chinese Academy of Sciences this summer … having to deal with his PhD defence at the same time as the GSoC project was quite a tall order!

He had this to say about himself and about his project …


I have been involved with the Eclipse community for a long time. When I discovered Scala this year, I realized that it was the language that I need. The openness of Scala struck me, as much as the technical merits of the language itself. The Scala IDE community combines two great open source communities and this summer’s GSoC gave me the opportunity to work on it. I like being part of this community. Join us to help to create great Scala tools!


Now that the GSoC ‘pencils down’ date has arrived, it is time to report to the community about the achievements of my Scala IDE project. The goal of this project is to provide Advanced Semantic Tools for the Scala IDE for Eclipse.

First, I am very appreciative for lots of helpful suggestions, advice and encouragement from my mentor Miles Sabin and other guys in the community. Without their help, it would not have been possible to finish this project.

There is a wiki page on the Scala IDE project site which explains some aspects of the features. Let me introduce them by starting with an example code snippet,

object String2Int {
  val a = "1";
  var b: java.lang.String = "3";
  implicit val somewords = new SomeWords("yeah!")

  implicit def string2Int(s: String) = {
    ((s.toInt)+1)
  }

  def main(args:Array[String]) {
    printInt(string2Int("3"))
    printInt(a+b)
    printIntWithSomeWords("5")(new SomeWords("..."))
    printIntWithSomeWords(2)

    val map = Map( 1 ->"one",2->"two")
  }

  def printInt(a:Int) {
    println(a)
  }

  def printIntWithSomeWords(a: Int)(implicit sw: SomeWords) {
    println(a)
    println(sw.words)
  }

  class SomeWords(val words: String)
}

This code stems from an example in Programming in Scala. But I modified it to be “more implicit”.

When you open the editor, all the places where implicit conversions and implicit parameters occur (not the implicit definitions themselves) have been highlighted, as follows,

Implicit visualization

Perhaps you don’t like the default green squiggly underlines as the visual indicator of implicit occurrences? Then you can customize the highlight style via Windows -> Preferences -> Scala -> Editor -> Syntax Coloring as follows,

Preferences

You can hide the highlighting by clearing the checkboxes and setting the underline style to “none”. In future we will add an enable/disable check box to simplify this process.

Along with the visual annotation for implicits, we provide automation around the annotation, known in Eclipse terminology as “quick assists”. The default shortcut for quick assist is “Ctrl+1″. The following screenshot shows the quick assist for an implicit conversion,

Implicit quick assist

After applying this quick assist we get the explicit version of above implicit conversion,

Inline expansion

The following screenshot shows the quick assist for implicit parameters,

Implicti parameter quick assist

After the applying the quick assist, we see the implicit arguments defined in the scope explicitly inlined as follows,

After inlining

One of Scala’s important features is support for type inference. With type inference we are not forced to write many tedious type decorations. However, Scala is a strongly type language and in some contexts it is better to declare the type explicitly, for example method return types.

So we have added functionality which provides explicit type completion, activated automatically by typing “:”. The current implementation is limited to val and method definitions for which the type can be inferred.

The following screenshot shows that I want to add an explicit type for val map. So I type the “:” after the map identifier. Then I get the inferred type quick assist here,

Inferred type completion

When I press Enter, we see the following,

Inferred type completion after expansion

Currently the explicit type is a little long. In future we will allow the qualified part to be moved to the import section.

It is a best practice to add explicit return types for methods (other than for methods which return Unit type). And sometimes you forget to add the “=” when defining a method. This makes the whole method return Unit unfortunately. With our new functionality and that best practice quick assist, you can find and fix this kind of mistake easily. For example, suppose you wanted to add the type for the method by “:” auto-completion. But you find that the proposed type is Unit. Then you will realize that you missed the “=”,

Inferred return type completion

Correct it and add the right type again as follows,

Inferred return type completion after expansion

Adding explicit types for val and method definition is a piece of cake now. In future we will improve explicit type completion to propose types from the classpath if the exact type cannot be inferred.

What do you think about these new features? A build/update site of the GSoC branch will be available shortly and any feedback will be appreciated. When the features has been proven stable, we will merge them into the main distribution. Then everyone can try them out!

Ed Merks
Ed Merks

Taking to the Clouds

I've been working hard these past weeks in my evil secret lair. Well, maybe not so secret, given that the results are, in true open source fashion, open: 323050. But it's definitely evil: among my tasks this week has been rejecting 6 out of every 7 Eclipse Summit Europe modeling submissions. I'm sure no one will take it personally and I'll remain ever so popular. Not! In any case, I'm taking to the clouds today!


That's right, I'm headed for Google's headquarters, with my brand new passport anxiously awaiting its first stamp of approval. (Did you know that a trip through the washing machine will launder all evidence of ever having been to the states?) It's Eclipse Day at the Googleplex where I'll be unveiling my master plan: world domination for Eclipse Modeling. Resistance is futile. Expect to be assimilated soon.

Eclipse Riena
Eclipse Riena

Who wants closable SubModules?

After working on the Riena framework for nearly a year now, together with some colleagues I am challanged to use Riena to build a small Client Server Application for our team. I never thought what a refreshing eye opener this can be from time to time. It is one thing to sit in your closed framework environment where everything makes total sense, but suddenly sitting on the other side of the table often makes you want more.

The requirement

So while designing the structure for our application we came across a requirement for Riena: closable SubModules. Until then, only Modules and ModuleGroups were closable via the UI, but as soon as a SubModule was added to the navigation tree it was there until the parent Module was closed or until it was removed programmatically in another way.

The ideas

The first step was to think about solutions in our own application, so we put a close button on every view that should be closable. Now that was ugly! But it was the fastest way to get the functionality. Okay, now that we had the functionality we had some time to think about solutions that would flowlessly fit into the Riena design:

close button in navigation

Idea No. 1

1. Put the close button in the navigation tree and let in only show up when the mouse is hovering over the node in the tree. This would have the advantage that it fits into Rienas design quite well, since the close buttons for the Modules are in the navigation as well. But the disadvantage was that we only have limited resources to work on our application and this solution would have taken quite a long time. There had to be an easier way.

Idea No. 3

Idea No. 3

2. Put the close button underneath the title bar. This would have been in the top right corner of the SubModuleView. But after some discussion this idea was dropped because it would have been a large change for all existing SubModuleViews now having to share the space with a little button.

3. Put the close button in the title bar of the SubModule. This is similar to the close buttons in the Microsoft Office Suite, where a second button under the “application close button” closes only the document visible at the time. It isn’t as flawless as Idea No. 1, but very easy to accomplish because the SubModuleTitleBar renderer extends the renderer of all Modules. Yeah, that was nice.

The solution

As you probably already guessed, solution No. 3 was implemented. All we had to do was to give the SubModuleNode the attribute “closable” and move some code around to make the close button show up in the title bar of the SubModuleView. Perhaps in the future we can also implement solution No. 1 and let the application programmer choose which one to use as we did with the error decoration.

What do you think? Would you use closable SubModules? Which solution would you have preferred?

Ankur Sharma
Ankur Sharma

Headless Build for Beginners - part V

Headless building Update Site

There is no easy way to achieve this. There have been some discussions in past and the Build and Test Automation article too touched it in brief. But its all hacky. I tried various stuff but the closest I could get was build features and plug-ins using (mentioned in) a site.xml and generating the metadata for them. The site.xml can be placed with them manually but I could not find a way to (automatically) update the site.xml with the feature and plug-ins build qualifiers. (There are always hacks like having a dummy site.xml and do a find-replace in it. Or write a custom ant task that emits XML for ste.xml - none of the hack is very maintainable or scalable)

After more investigation I realized may be I was trying to solve the wrong problem. We really don't need the update site (not if you are using Eclipse 3.4 or later). A p2 repository is not only easy to generate but is also the recommended way of distributing features and plug-ins.

Headless building a p2 repository

Now a p2 repo can be generated either from a bunch of features and plug-ins or directly from a product configuration. Both explained in Eclipse help. We will here take a product configuration and build a p2 repository for it. The setup will be same as discussed before. However this time, we will copy all the files from /org.eclipse.pde.build/templates/headless-build folder to our build configuration folder (build\buildConfiguration). Thus, the build structure will now looks like this

<buildConfigurationDirectory>
allElements.xml
build.properties
customAssembly.xml
customTargets.xml
<buildDirectory>
plugins/
com.example.helloworld
com.example.product
example.product
features/
com.example.helloworld.feature

The current setup will generate the product when build. We now need to add a hook for repository generation. This can be done in customAssembly.xml. Open it in Eclipse or your favorite text editor and make the following changes in post.gather.bin.parts target.

<target name="post.gather.bin.parts">
<p2.publish.featuresAndBundles
repository="file:/${buildDirectory}/repository"
source="${buildDirectory}/tmp/${archivePrefix}"
compress="true"
>
</p2.publish.featuresAndBundles>
</target>

Note that p2.publish.featuresAndBundles is just of the of ant task that can be used to generate metadata. There are more for different situations. The idea here was more to see how to add custom call in ant scripts.

Run the build as before
java -jar c:\eclipse\plugins\org.eclipse.equinox.launcher_1.1.0.v20100507.jar -application org.eclipse.ant.core.antRunner -buildfile c:\eclipse\plugins\org.eclipse.pde.build_3.6.0.v20100603\scripts\productBuild\productBuild.xml -Dbuilder=c:\build\buildConfiguration

This will create a p2 metadata repository in file:/${buildDirectory}/repository folder. You can control the location using repository property.

Marcel Bruch
Marcel Bruch

Eclipse and Academia - Briding the Gap between Practitioners and Researchers? A project proposal...


A few months ago Chris started a discussion about Eclipse and Academia and how Eclipse could support research projects to participate in the Eclipse Ecosystem. Furthermore, the upcoming Eclipse Magazin will also contribute to this discussion. However, the discussion how Eclipse could help and benefit from research projects is dangling. With this post, I would like to pick pick up Chris' blog post and present an idea how eclipse and research community could get together to create something (I think) very fancy...


In my last posts, I presented our preliminary work on improving IDEs leveraging the hidden knowledge available in example code that uses other APIs (visit code-recommenders@eclipselabs and the official project homepage  for more details). A few weeks ago we wrote down our vision of how future IDEs should work---which you can find and comment below. This post is basically the preprint version of this paper (which got accepted today at the Working Conference "Future of Software Engieering Research") and we would love to get the your feedback to the vision we present here. As said above, we did a lot of work to get where we are today and the question is now: Should we continue to let the visions below come reality? Clearly, this vision will only work with a very vital community around the project - which I think can be found nowhere else than at Eclipse. But how do you feel about that? Just read the vision and tell us about your opinion (yes, I know it's longer than a standard post. Sorry for that but I hope it's worth reading ;-) ).

IDE 2.0: Collective Intelligence in Software Development


ABSTRACT

Today’s Integrated Development Environments (IDEs) only integrate the tools and knowledge of a single user and workstation. This neglects the fact that the way in which we develop and maintain a piece of software and interact with our IDE provides a rich source of information that can help ourselves and other programmers to avoid mistakes in the future, or improve productivity otherwise. We argue that, in the near future, IDEs will undergo a revolution that will significantly change the way in which we develop and maintain software, through integration of collective intelligence, the knowledge of the masses. We describe the concept of an IDE based on collective intelligence and discuss three example instantiations of such IDEs. 



1 Introduction

Under the right circumstances, groups are remarkably intelligent and are often better than the smartest person in them.
– James Surowiecki: Wisdom of the Crowds

During the past decades, software systems have grown significantly in size and complexity, making software development and maintenance an extremely challenging endeavor. Integrated Development Environments (IDEs) greatly facilitate this endeavor by providing a convenient means to browse and manipulate a system’s source code and to obtain helpful documentation on Application Programming Interfaces (APIs). Yet, we argue that there is great space for improvement by exploiting collective intelligence, the knowledge of the masses.

The leveraging of user data to build intelligent and user-centric web-based systems, commonly summarized as the Web 2.0, is the source of our inspiration. A Web 2.0 site allows its users to interact with each other as contributors to the website’s content, in contrast to websites where users are limited to the passive viewing of information that is provided to them. Web 2.0 examples include web-based communities, web applications, social-networking sites, video-sharing sites, wikis, blogs, mashups, and folksonomies.

Amazon, for instance, creates recommendations based on purchase behaviors of its customers or finds interesting similar products based on how customers interact with search results. Netflix, a video-on-demand service, features a web application that leverages user ratings on movies to recommend likely interesting movies to other users. These systems have in common that they leverage crowds to continuously improve the quality of their services, either through implicit feedback (e.g., user click-through behaviors), explicit feedback (e.g., ratings for movies) or user-generated content (e.g., product reviews and movie critics).

Today’s IDEs behave more like traditional “Web 1.0” applications in the way that they do not enable their users to contribute and share their knowledge with others, neither explicitly nor implicitly, and thus hinder themselves to effectively exchange knowledge among developers. What would it mean to bring collective intelligence into software development? Figure 
1a shows the current state of the practice: software developers use IDEs that are “integrated” only in the sense that they integrate all tools necessary to browse, manipulate and build software on a single machine. If a programmer has a question about a particular piece of code, for instance an API, she has to browse the web for solutions—by hand. After she has found the solution and solved her problem, the newly gained knowledge is usually lost. 


Figure 1: Our vision: in the future, IDEs will be linked through global knowledge bases



Figur
e 1b shows our vision of the near future: IDEs will support developers through integration with a global knowledge base. This knowledge base will receive information from implicit and explicit user feedback. By implicit feedback we mean anonymized usage data that the cross-linked IDEs will send to the knowledge base automatically and spontaneously (in the figure, we represent such spontaneous activity through dashed arrows). The knowledge base will also comprise explicit user feedback in the form of user-written documentation, error reports, manuals, etc. In this work, we will show that such data can help, for example, to improve ranking heuristics, or to focus developer activity.

Crucially, the knowledge base itself is intelligent: it will use novel data-mining techniques to integrate the different sources of information to produce new information that has added value. For instance, if the knowledge base discovers that people who write an equals method in Java often write a hashCode method on the same type at the same time, or do so after a longer debugging session, then the knowledge base may be able to discover the important rule that, in Java, every type that implements equals should also implement hashCode, and that missing this rule likely causes bugs.

The remainder of this paper is organized as follows. In Sec. 2, we materialize IDE 2.0 by discussing example intelligent IDE services that leverage implicit and explicit user feedback to aid programmers in everyday software-development tasks. We show that not only feedback data itself but in particular derived information, obtained through data mining, has the potential of greatly easing the software-development process as a whole. Moreover, as the data is persisted, it will survive over time, unlike today, where much information gets lost and needs to be re-discovered over and over again. In Sec.3, we materialize IDE 2.0 by drawing parallels between the main characteristics of IDE 2.0 and those of Web 2.0. Finally, Sec. 4 summarizes the paper.




2 From IDE 1.0 towards IDE 2.0

In the following we give three examples of how research in collective intelligence can improve existing IDE services. We split the discussion of each example into three sections. IDE 1.0 sections describe the state-of-the-art in today’s IDEs. Under IDE 1.5, we briefly summarize current research to improve IDE 1.0 services. IDE 2.0 sections discuss how collective intelligence could solve some of the issues of these approaches. 



Intelligent Code Completion

IDE 1.0: Code completion is a very popular feature of modern IDEs, a life without which many developers find hard to imagine. One major reason for its popularity is that developers are frequently unaware of what methods they can invoke on a given variable. Here, code completion systems (CCSs) serve as an API browser, allowing developers to browse methods and select the appropriate one from the list of proposals. However, current completions are either computed by rather simplistic reasoning systems or are simply hard-coded. For instance, for method completion, CCSs only consider the receiver’s declared type. This often leads to an overwhelming number of proposals. Triggering code completion on a variable of javax.swing.JButton results in 381 method proposals. Clearly, developers only need a fraction of the proposed methods to make their code work. Code templates are an example for hard-coded proposals. Templates (like the Eclipse SWT Code Templates) serve as shortcuts and documentation for developers. Manual proposal definitions are labor intensive and error prone.

IDE 1.5: Researchers have recognized these issues. For instance, approaches exist that analyse client code to learn which methods the clients frequently use in certain contexts, and rearrange method proposals according to this notion of relevance [2]. Tools like XSnippet, Prospector and Parseweb [7 9 10] attempt to solve the issue of hard-coded code templates by also analyzing source code, identifying common patterns in code. Although obviously useful, these systems didn’t made it into current IDEs. We argue that the primary reason for this is the lack of a continuously growing knowledge base. To build reliable models, source-code based approaches require example applications and full knowledge about the execution environment (i.e., classpath, library versions etc.). However, finding a sufficiently large set of example projects is difficult and tedious, and creating models for new frameworks is too time-consuming yet. While such approaches can sufficiently support a few selected APIs, we argue that they do not scale when tens of thousands of APIs should be supported.

IDE 2.0: So, how can we build continuously improving code completion systems then? To solve the scalability problem, code completion systems must allow users to share usage information among each other in an anonymized and automated way—from within the developer’s IDE. This continuous data sharing allows recommender systems to learn models for every API that developers actually use. IDEs are very powerful when it comes to extracting information: they have access to information about the execution environment and about user interactions, even with respect to certain APIs. But the new, massive data sets derived from this information pose a challenge. We will likely require new algorithms to find reliable and valuable patterns in this data. Whatever means future code completion systems will use to build better recommendation models, the systems will be based on shared data. It will be the users who provide this data, and it is important to realize that, as the user base grows, the recommendation systems will be able to continuously improve over time, making intelligent completions that are useful for novice developers and experts alike.


 

Example & Code-Snippet Recommendations

IDE 1.0: Source-code examples appear to be highly useful to developers, whenever the documentation of the API at hand is insufficient [8]. This is evident by the raise of several code search engines (CSEs) over the last few years, like Google Codesearch, Krugle, and Koders, just to name a few. However, current CSEs almost exclusively use standard information-retrieval techniques that were developed for text documents. While source code is text, it also bears important inherent structure. Disregarding this structure causes less effective rankings and misleading code summaries.

IDE 1.5: Researchers have presented a number of approaches [3 5 11] that improve certain aspects of CSEs. All these approaches exploit structure, like inheritance relations, method calls, type usages, control flow and more, however they face two severe problems. First, source code provides much more structure than text. Thus, ranking systems have to take into account many more features when building the final ranking for a search query. Consequently, it is hard to derive optimal weights for these features, so that the resulting scoring function will perform as well as possible. Often, a fixed scoring systems will perform "well enough" but not be optimal. Another issue with current CSEs is that they ignore the personal experience of the user who issued the query. Many current web search engines now support “personalized search”, which leverages the personal background and interests of a user to find documents that are likely to be interesting for this user, but not necessarily for others. Current CSEs lack such functionality.

IDE 2.0: How can one improve ranking and realize personalized search in CSEs? The key to solving both problems is to leverage implicit user feedback. To solve the manual-weight-tweaking problem of search engines, recent work [4] has shown that leveraging observations of how users interact with the search results can significantly improve the precision of existing search engines. The authors used the information whether or not the user inspects a search result to automatically adjust feature weights. This produces an optimized ranking where all inspected results are listed above those that the user did not investigate. To implement personalized code search engines, one can infer the personal background (or experience) of a developer by the code she has already written. Then, CSEs could first display code examples that are similar to examples previously explored or, on demand, code examples that allow the developer to learn new information. We are certain that IDE services in general, not only those that we discussed, can greatly benefit from leveraging implicit user feedback.


 

Extended Documentation

IDE 1.0: Software engineers widely accept that documenting software is a tedious job. Especially open-source projects frequently lacks sufficient resources to produce comprehensive documentation. Both Sun and the Eclipse Foundation recently started to address this problem by opening their documentation platforms to their users. Eclipse asks its users to provide and update tutorials at the central Eclipse Wiki. Sun’s “Docweb” allows users to edit Javadoc API documentation, and to provide code examples or cross references to other interesting articles in the web. These tools aim to leverage a Wikipedia-style approach tailored to software documentation. Past experience has shown, however, that such systems often suffer from a lack of user participation. We believe that the primary cause for this lack of participation is the fact that people may not be willing to document APIs which they have no control over, because these APIs may change rapidly at any time: they may be completely outdated in just a few months.

IDE 1.5: Recent research therefore addresses the problem from another angle, enriching existing documentation with automatically mined documentation [1 6]. Such approaches identify frequent patterns or interesting relations in code, and generate helpful guidelines from these relations. However, generated documentation may not always be helpful. Like text mining, documentation mining uncovers any relation between code elements, no matter whether or not this relation is useful to consider. The problem is aggravated by the fact that it is sometimes the surprising relations that are the most useful. Another drawback of mining approaches is that they cannot provide rationales for their observations, leaving it up to the developer to make sense of the data.

IDE 2.0: How could collective intelligence address the issues mentioned above? The key to a solution is a mixture of explicit user feedback and user-provided content. In the future, we expect generated documentation to be judged by thousands of users, enabling people to evaluate the quality of their services immediately—tool developers and documentation providers alike. Furthermore, we expect collective intelligence to enable us to migrate documentation from older to newer versions more easily. For example, when a new version of an API becomes available, explicit user feedback will make apparent which parts of the documentation remain valid for the newer version and which parts require updating. Explicit user feedback will also allow users to attach rationale to mined documentation, allowing the documentation to not only state that users must follow a certain principle but why.

These examples are just the tip of the iceberg. We are confident that the software engineering research community will invent many more interesting techniques to generate, judge, and complete documentation.



3 From Web 2.0 to IDE 2.0

We have used the analogy to “Web 2.0” to indicate that this new generation of web applications and our view of future IDEs have something in common. In the following, we discuss the similarities between Web 2.0 and IDE 2.0 to make this analogy more concrete.

In this section, we define a set of principles that we expect successful IDE 2.0 services to follow. Some of the concepts are paraphrased from Tim O’Reilly’s principles for successful Web 2.0, described in his article “What is Web 2.0?”.

1. The Web as Platform. The web as platform is the core concept of Web 2.0. In various ways, clients and servers share data over the web. We expect the same to hold for future collaborative IDE 2.0 services. These services rely on client-side usage data and thus, the web is also fundamental to them. A notable difference between IDE 2.0 and Web2.0 is that IDEs offer a much larger spectrum of data and also allow for client-side pre-processing of data like static analysis code analysis. Such pre-processing may even be crucial to allow for proper privacy. Furthermore, one needs to distribute to clients recommendation models that are built on the server-side. Local databases or caches can increase the scalability of these systems; crucial, when dealing with millions of request per day. Whatever the particular technology may be, the web will be the platform for IDE 2.0.

2. Data is key. Data is key to any IDE 2.0 service. However, here we fundamentally differ from Tim O’Reilly’s understanding of who owns this data. In Web 2.0, data is the key factor for the success of an application over its competitors. In contrast, we strongly believe in Open Data: all collected data is publicly available. This fosters a vital ecosystem around the concepts of IDE 2.0 and enables sustainable research. Successfully IDE 2.0 services will use both raw data and derived knowledge will facilitate innovation instead of locking in data or users.

3. Harnessing Collective Intelligence. Leveraging the wisdom of the crowds is the third fundamental concept of successful Web 2.0 applications—and same holds for IDE 2.0. The examples introduced in the previous section used either user-provided content (like source code, updated documentation or code snippets), implicit feedback (like user click-through data used to improve rankings), or explicit feedback (like ratings for judging the quality of relevance of generated documentation) to build new kind of services. It is important to recognize that, while individuals may be able to build these services, these services cannot unleash their potential without the crowds sharing their knowledge. Only with collective intelligence, IDE services like intelligent code completion, example recommenders or even smart documentation systems become possible.

4. Rich User Experiences. The appearance of AJAX gave web applications a new look and feel, bringing web applications much closer to desktop applications than ever before. In the context of IDE 2.0, intelligent, context-sensitive recommender systems will evolve that recommend relevant APIs or documentation where appropriate and help to reduce the clutter in IDEs at the same time. However, providing a rich user experiences is fundamental for users to accept such services. Similar to Google Search, simple and intuitive interfaces seamlessly integrated into existing IDE concepts like code completion, quick fixes etc. are the major key to success.

5. Lightweight Programming Models. In web 2.0, mashups (applications that combine several other (web) applications to build new services on top of existing ones) evolved, building new services the application developers never considered. Excellent IDE 2.0 services will encourage others to build their services on top of existing ones by providing public and easy-to-use APIs. Clearly, in the early days we expect such services to be data-driven, i.e., they will leverage the same data for enhancing several aspects of current IDEs or to port existing services to other IDEs. Note that Open Data is necessary to enable such services. However, over time, services will use other services to build what we call IDE mashups.


 

4 Summary

The concepts behind Web 2.0 are a great fit for future IDE services and we expect future services to meet at least one if not almost all of these properties. However, the Software Engineering research community has to play a key role in unleashing the full power of the crowds. First, and most importantly, it has to provide an appropriate environment for building and evaluating IDE 2.0 services. Strong partners like the Eclipse Foundation or Sun/Oracle already support and promote such new IDE concepts today, and their help will be crucial to providing access to large user communities in the future. But there is an incentive for these partners: they will profit from new exciter features, making the IDE itself appear very innovative.

Second, the Software Engineering research community is the connective link between practitioners and researchers in machine learning. Most IDEs only contain instances of rather primitive machine-learning algorithms. It will be our job to identify the problems that developers face in their day-to-day work, to provide appropriate data as input for machine learners, and to evaluate and reintegrate these results into IDEs. Thus, IDE 2.0 research will create new fascinating and challenging applications of machine learning aside the current markets.

To sum up, IDE 2.0 services have much potential to improve developer productivity and provide a fantastic playground for new algorithms. They bring together several research communities at the same time, to solve a new generation of challenges in software engineering. When tackling the problem now and in a farsighted, IDE 2.0 will be one of the major research areas of the near future. 



5 References

[1] Marcel Bruch, Mira Mezini, and Martin Monperrus. Improving the quality of framework subclassing directives. InMSR, 2010.

[2] Marcel Bruch, Martin Monperrus, and Mira Mezini. Learning from examples to improve code completion systems.In FSE, 2009.

[3] Reid Holmes and Gail C. Murphy. Using structural context to recommend source code examples. In ICSE, 2005.

[4] Thorsten Joachims. Optimizing search engines using clickthrough data. In KDD, 2002.

[5] Erik Linstead, Sushil Bajracharya, Trung Ngo, Paul Rigor, Cristina Lopes, and Pierre Baldi. Sourcerer: mining andsearching internet-scale software repositories. Data Min. Knowl. Discov., 18(2), 2009.

[6] Fan Long, Xi Wang, and Yang Cai. Api hyperlinking via structural overlap. In FSE, 2009.

[7] David Mandelin, Lin Xu, Rastislav Bodík, and Doug Kimelman. Jungloid mining: helping to navigate the api jungle.In PLDI, 2005.

[8] Martin Robillard. What makes apis hard to learn? answers from developers. IEEE Software, 2009.

[9] Naiyana Sahavechaphan and Kajal Claypool. Xsnippet: Mining for sample code. In OOPSLA, 2006.

[10] Suresh Thummalapenta and Tao Xie. Parseweb: a programmer assistant for reusing open source code on the web.In ASE, 2007.

[11] Hao Zhong, Tao Xie, Lu Zhang, Jian Pei, and Hong Mei. Mapo: Mining and recommending api usage patterns. InECOOP, 2009. 


(Please note, this list is by far incomplete but a 4 pages limitation requires you to select just a few publications)

6 Disclaimer ;-)


This is a vision of what we want to achieve with the code recommenders project. So far you have seen preliminary versions of intelligent code completion, extendend javadocs, and example code search. In the pipeline is a API misuse detector we will present in a few weeks. However, we are currently starting to make all these tools "ide 2.0-ready" and would propose this project as Eclipse Incubator project. But this project would need your help in many ways to be successful! Thus:

Let us know whether you like the idea and would support this project when becoming an open source / open data Eclipse Project. And even if you would not support it: Tells us what would prevent you from using it. If it is a technical issue I'm sure we can fix it. In other cases we would love to learn what causes "rumbling in the tummy" ;)

If you want to learn more about the project drop us a mail and/or visit the project homepage


All the best,
Marcel

Litrik De Roy
Litrik De Roy

Dynamic working sets

If you have a lot of projects in your Eclipse workspace you should check out the Dynamic Working Sets plug-in.

It allows you to define working sets based on a regular expression. If a project name matches the regex it will be included in the working set.

It sure beats adding new projects to existing working sets all the time. Really handy to keep your workspace organized.

Holger Staudacher
Holger Staudacher

An Oscilloscope in the browser?

Last week Wim Jongman bloged about the Nebula Oscilloscope widget. It’s just an awesome widget for monitoring activity. See Wim’s post to form an opinion yourself.

So, for me as a RAP developer, the first question I always ask myself when seeing such a cool thing is: “Will it run on RAP?”. I followed the steps Wim described to get the Oscilloscope running, changed the target to RAP, commented out one line of code and started the application. You can see the result in the screencast below.

I think the result is just awesome. It runs very smooth with almost no lags. For all of you who don’t know it yet, this is possible because we implemented the GC and published it with RAP 1.3. The updates from the server are realized via the UICallback mechanism of RAP. I think this video shows that, in the meantime, RAP became a very sophisticated technology. We are all looking forward to seeing a lot more cool things like this working with RAP.

Sven Efftinge
Sven Efftinge

Parsing Expressions with Xtext

Parsing simple XML-like, structural languages with Xtext is a no-brainer. However, parsing nested expressions is often considered a bit more complicated. This is because they are more complicated due to their recursive nature and also because with Xtext you have to avoid left recursive parser rules. As the underlying parser (generated by Antlr) uses a top-down approach it would recurse endlessly if you had a left recursive grammar.

Let's have a look at parsing a simple arithmetic expression:

2 + 20 * 2
If you know EBNF a bit and wouldn't think about avoiding left recursion, operator precedence or associativity, you'ld probably write a grammar like this:
Expression :
Expression '+' Expression |
Expression '-' Expression |
INT;
This grammar would be left recursive because the parser reads the grammar top down and left to right and would endlessly call the Expression rule without consuming any characters, i.e. altering the underlying state of the parser. While this kind of grammars can be written for bottom-up parsers, you'ld still have to deal with operator precedence in addition. That is define that a multiplication has higher precedence than an addition for example.

In Xtext you define the precedence implicitly when left-factoring such a grammar. Left-factoring means you get rid of left recursion by applying a certain technique, which I will show in the following.

So here is a left-factored grammar (not yet working with Xtext) for the expression language above :
Addition :
Multiplication ('+' Multiplication)*;

Multiplication:
NumberLiteral ('*' NumberLiteral)*;

NumberLiteral:
INT;
As you can see the main difference is that we have three rules instead of one and if you look a bit closer you see, that there's a certain delegation pattern involved. The rule Addition doesn't call itself but calls Multiplication instead. The operator precedence is defined by the order of delegation. The later the rule is called the higher is its precedence. This is at least the case for the first two rules which are of a left recursive nature (but we've left-factored them now). The last rule is not left recursive which is why you can write them down without applying this pattern.

We should allow users to explicitly adjust precedence by adding parenthesis, e.g. write something like (2 + 20) * 2.
So let's add support for that (note that the grammar is still not working with Xtext):
Addition :
Multiplication ('+' Multiplication)*;

Multiplication:
Primary ('*' Primary)*;

Primary :
NumberLiteral |
'(' Addition ')';

NumberLiteral:
INT;
So once again: if you have some construct that recurses on the left hand side, you need to put it into the delegation chain according to their operator precedence. The pattern is always the same, the thing that recurses delegates to the rule with the next higher precedence.

Construction of an AST

Now that we know how to avoid left recursion, let's have a look at what the parser produces. In Xtext each rule returns some value. Parser rules return AST nodes (i.e. EObject instances), enum rules return enum literals and datatype rules as well as terminal rules return simple values like strings and the like (EDatatype in EMF jargon).
Xtext can automatically infer whether some rule is a parser rule, i.e. constructs and returns an AST node or if it is a datatype rule. Above's grammars only consisted of datatype rules so all they would produce is a string.
In order to construct an AST we need to add Assignments and Actions. But before we do that we need to talk about return types.

The return type of a rule can be specified explicitly using the 'returns' keyword but can be inferred if the type's name is the same as the rule's name.
That is
NumberLiteral : … ;
is a short form of
NumberLiteral returns NumberLiteral : …. ;
However in the case of the expressions grammar above, the rules all need to return the same type since they are recursive. So in order to make the grammar functional we need to add a common return type explicitly (but the grammar is still missing some bits):
Addition returns Expression:
Multiplication ('+' Multiplication)*;

Multiplication returns Expression:
Primary ('*' Primary)*;

Primary returns Expression:
NumberLiteral |
'(' Addition ')';

NumberLiteral:
INT;
The AST type inference mechanism of Xtext will infer two types: Expression and NumberLiteral. Now we need to add assignments and Actions in order to store all the important information in the AST and to create reasonable subtypes for the two operations.

In the following you see the final fully working Xtext grammar:

Addition returns Expression:
Multiplication ({Addition.left=current} '+' right=Multiplication)*;

Multiplication returns Expression:
Primary ({Multiplication.left=current} '*' right=Primary)*;

Primary returns Expression:
NumberLiteral |
'(' Addition ')';

NumberLiteral:
value=INT;
Let's go through the grammar as the parser would do it for the expression
( 1 + 20 ) * 2
(I'm sure it's pretty hard to follow what's going just by reading this text. Therefore I have prepared a small video where I visualize and explain what is going on. You can find it at the end of this section.)

The parser always starts with the first rule (Addition). Therein the first element is an unassigned rule call to Multiplication which in turn calls Primary. Primary now has two alternatives. The first on is calling NumberLiteral which consists only of one assignment to a feature called 'value' of what the INT rule returns.

But as the first token in the expression is an opening parenthesis '(' the parser will take the second alternative in Primary, consume the '(' and call the rue Addition. Now the value '1' is the look ahead token and again Addition calls Multiplication and Multiplication calls Primary. This time the parser takes the first alternative because '1' was consumed by the INT rule (which btw. is a reused library terminal rule).

As soon as the parser hits an assignment it checks whether an AST node for the current rule was already created. If not it will create one based on the return type, which is NumberLiteral. The Xtext generator will have created an EClass 'NumberLiteral' before which can now be instantiated. That type will also have a property called value of type Integer, which will get the value '1' set. This is what the Java equivalent would look like:
// value=INT
if (current == null)
current = new NumberLiteral();
current.setValue(ruleINT());
...
Now that the rule has been completed the created EObject is returned to the calling rule Primary, which in turn returns the object unchanged to its own caller. Within Multiplication the call to Primary has been successfully parsed and returned an instance of NumberLiteral. The second part of the rule is a so called group (everything within the parenthesis). The asterisk behind the closing parenthesis states that this part can be consumed zero or more times. The first token to consume in this part is the multiplication operator '*'. Unfortunately in the current situation the next token to consume is the plus operator '+', so the group is not consumed at all and the rule returns what they got from the unassigned rule call (the NumberLiteral) .

In rule Addition there's a similar group but this time it expects the correct operator so the parser goes into the group.
The first element in the group is a so called action. As Xtext grammars are highly declarative and bi-directional it is not a good idea to allow arbitrary expression within actions as it is usually the case with other parser generators. Instead we only support two kinds of actions. This one will create a new instance of type Addition and assign what was the to be returned object to the feature left. In Java this would have been something like:
// Multiplication rule call
current = ruleMultiplication();
// {Addition.left=current}
Addition temp = new Addition();
temp.setLeft(current);
current = temp;
...
As a result the rule would now return an instance of Addition which has a NumberLiteral set to its property left. Next up the parser consumes the '+' operator. We do not store the operator in the AST because we have an explicit Addition type, which implicitly contains this information.
The assignment ('right=Multiplication') calls Multiplication another time and assigns the returned object (a NumberLiteral of value=20) to the property named right.

If we now had an additional plus operation '+' (e.g. 1 + 2 + 3) the group would match another time and create another instance of Addition. But we don't and therefore the rule is completed and returns the created instance of Addition to its caller which was the second alternative in Primary. Now the closing parenthesis is matched and consumed and the stack is reduced once more.

We are now in rule Multiplication and have the multiplication operator '*' on the look ahead. The parser goes into the group and applies the action. Finally it calls the Primary rule gets another instance of NumberLiteral (value=2), assigns it as the 'right' operand of the Multiplication and returns the Multiplication to Addition which in turn returns the very same object as there's nothing left to parse.

The resulting AST looks like this:


The following video tries to explain what you just have read. The grammar is slightly different, but I'm sure this won't be problem for you ;-).




Associativity

There is still one topic I should mention, which is associativity. There is left and right associativity as well as none associativity. In the example we have seen left associativity. Associativity tells the parser how to construct the AST when there are two infix operations with the same precedence. The following example is taken from the corresponding wikipedia entry:

Consider the expression a ~ b ~ c. If the operator ~ has left associativity, this expression would be interpreted as (a ~ b) ~ c and evaluated left-to-right. If the operator has right associativity, the expression would be interpreted as a ~ (b ~ c) and evaluated right-to-left. If the operator is non-associative, the expression might be a syntax error, or it might have some special meaning.
We already know the most important form which is left associativity:
Addition returns Expression:
Multiplication ({Addition.left=current} '+' right=Multiplication)*;
Right associativity is done using the following pattern (note the quantity operator and the call to the rule itself at the end):
Addition returns Expression:
Multiplication ({Addition.left=current} '+' right=Addition)?;
And if you don't want to allow multiple usages of the same expression in a row (hence non-associativity) you write:
Addition returns Expression:
Multiplication ({Addition.left=current} '+' right=Multiplication)?;
Note that sometimes it's better to allow associativity on parser level, but forbid it later using validation, because you can come up with a better error message. Also the whole parsing process won't be interrupted, so your tooling will generally be more forgiving.

(This post has also been included into the Xtext User Guide since version 1.0.1)

August 24, 2010

Denis Roy
Denis Roy

Better (some?) Wifi coverage at ESE

I’ve never been to Eclipse Summit Europe.  I’m told it’s because there’s not enough beer in Germany to accommodate my lavish consumption.

Regardless, I’ve started working with the conference organizers towards providing better/more Wifi coverage at the conference in a manner that would resemble what is provided at EclipseCon.

This is where we play the game of estimating how much Internet bandwidth you’ll use up, double the number, then double it again, and then have our calculations be demonstrably wrong once the conference is in full swing.  But that’s part of the fun!

Miles Parker
Miles Parker

Making Eclipse More Welcoming

From the title you might be thinking I was going to talk about how we can encourage new-comers to get involved with and contribute to Eclipse, blah blah blah. But you'd be wrong. I'm actually going to talk about a thingie that shows up on your install when you first pull off the shiny shrink wrap of an Eclipse RCP / SDK Application / Product / Whatever.. Rather than get into the details -- the Eclipse documentation is quite good (as one hopes it would be!), and there are a number of nice tutorials on it -- I'd like to discuss more generally what Eclipse offers, how it fits into the overall picture and discuss how it might be improved. There may be a few useful technical tidbits buried in here somewhere..

I wrote most of this post back in February but have been too busy with other things to ever get back to it. But this bugzilla I received last night made me think that I wasn't the only one that has had trouble grasping the overall logic of the Eclipse User Assistance system, so I decided to spend the time to resurrect it. I hope it gets a little discussion going.

Drawing Users In


I've been thinking a lot about initial user experience lately as I've been getting ready to release more -- for lack of a better description -- consumer-oriented offerings. As much as I'd like to think otherwise, I keep getting corralled back to the view that no matter how well explained and functional P2 provisioning is or becomes a (large majority?) of people will want to click on a button on your website, download the software and run it. They don't care -- and in fact don't want to even know -- about the Swiss Army Knife. They just want the can opener. Maybe later they'll be happy to find out that they can also use it as a screwdriver (but anyway, isn't that what a butter knife is for?), but in the meantime it would be really nice if when they're rooting around in their drawers for it, it is labeled "can opener" in bright letters or better yet has some visual cues that make it look like it might be for opening cans.

And while some people are like me (and probably you) in that they like to open everything up and experiment, other people like to take the direct route -- they'd like to pull the shrink wrap off of their new can opener box and have a nice little full color tri-folded diagram about how to use the can opener. So, while the rest of us are busy chatting on IRC about the most efficient way to saw the top off of a tomato soup can with a nail file, and writing bug reports requesting that the tooth pick be made out of mahogany rather than plastic ("but mahogany has poor wear characteristics") they're sitting down for lunch. In the most brilliant marketing phrase out of the most brilliant marketing company of all time, these people are referred to as "the rest of us", and they really aren't anything like "us". If by us we mean, "us software developers". When I'm in the kitchen, I prefer Can Openers too. And I use a Mac because there is a lot of technical noise and clutter I don't want or need to know about either.

So, how to make a good first impression? How to lead your users into actually using your software? I don't want the results of all of my efforts to be the unused whatsit at the bottom of the drawer of lost gadgets. At the very least, I want users to tell me why my can opener is useless and send it back for a refund. In order to get to that point, I'm going to need them to use it to try to open just one can. And, if they've never seen a can before, along the way I need to let them know that food is stored in it, that they need to go and buy one at the store first ("remember, you'll need to pay for it before leaving..you'll need money for that, which comes from.."), etc.. And that's what I think initial user experience is all about. Not making assumptions about what users do and don't know while accommodating different levels of user interest, experience and curiosity.

OK, enough technical blah blah blah -- to specifics. One of the many nice things about Eclipse is that it already has an enormous amount of infrastructure supporting User Assistance. And, one of the challenging things about Eclipse -- at least for me -- is that employing that infrastructure is going to involve some fiddly bits and dipping into a lot of different areas.

Help!!


You need some! Really. User's like it!

There are many gaps in the overall Agent Modeling Platform, but the products I'm developing are focussed solely on developing Agent-Based Models and there is a lot to that -- users need to be able to figure out how to use the can opener, but they also need to now why and for what they might want to use one. We're lucky enough to have one Manual for an earlier related tool (written by Damon Centola), so I started with integrating that into the docs for Ascape a related tool I worked on for about ten years prior to moving to the Eclipse platform. That meant a lot of work just trying to parse a manual from Word to Apple Pages to HTML output to readable, well-formatted HTML output -- and then moved on to write the Help as well as integrate that with other aspects of the system. Then I started in on creating some (pretty extensive and reasonably complete, I think) user documentation including design overviews, user tools, and examples. By the way, it sounds like an obvious point, but it's good to think a lot about how your documentation is organized. The basic documentation outline for the core Eclipse projects is very good, and while the overall design won't fit perfectly for every project, it's a good place to start and following the common outline provides a seamless experience to users as they move from one Eclipse related tool to another.

The Eclipse TOC editor works quite well for all of this -- there is only one plug-in point to maintain and the maintaining hierarchical structures is easy. Even better, the Eclipse ecosystem now supports some really good tools for creating and most importantly maintaining help content and doing so in a distributed automated way. A number of months back I spent a great deal of time stealing and modifying XText's documentation system. Now we can write all of the AMP documentation in WikiText, launch an ant script, and get all kinds of docs automagically generated. When complete we had nearly two hundred pages of PDF text including the converted Ascape manual, as well as online help and Eclipse integrated help.

Welcome!


The next piece is providing a way for users to be guided into actually using these cheat sheets, references and so on. For that, Eclipse has the welcome screen. The welcome screen is a really nice feature of Eclipse that is under-appreciated and a bit under-utilized. Part of that may be that it is surprisingly difficult to get up to speed with how to use it. There are a number of pieces that have to work together -- a theme I'll return to below -- and you have to poke around quite a bit to figure out where the points of integration are with other projects. For example, for my IDE build, I wanted to be able to turn off some help items that my users probably wouldn't need -- like plug-in development samples -- while keeping some they would, like for (the perennially problematic) SVN integration.

What you end up with is really useful -- if users use it. But I've watched a fair number of neophyte users start out with the software from scratch, and what is the first they do when they launch the software? Click on the "close" button to get rid of the this weird view that is blocking the software! That's in large part due to the initial Eclipse start page that had a bunch of cool symbols on it but really, it's actually not at all apparent why it would be at all useful. So the first change to make for an IDE build is to change the style to Slate, which brings up the four or five main categories along with a description of why they might be useful.

Cheat Sheets


I'd already spent some time getting up to speed on Cheat Sheets. Cheat Sheets aren't something that I personally use a lot -- they are generally a bit to linear feeling for me -- but I'd probably benefit from doing so, just as I'd probably benefit from reading the damn manuals before blindly diving into implementation! My fellow developer and ABM tool user Ed Mackerrow has been pushing me to use them more as he's found that they work really well for easing people into tools.

Now that I'm beginning to work with them a bit more, I'm starting to think of cheat sheets as less clingy versions of Wizards -- they walk you through doing something useful, but when you've done it a few times they don't hang around wanting to hold hands with you all of the time. And they're a lot easier to develop than Wizards.

Generally the cheat sheet authoring process has been really straightforward. If you don't use them and have any kind of product or set of features involving getting people through two or more non-obvious steps, then you really need to try it. (Is there a cheat sheet cheat sheet?)

But as with the Welcome system, the cheat sheet integration process is not so easy. There are some fiddly bits, things that seem more complex that they need to be. Most of that has to do with just mucking around with configuration stuff. In order to create and maintain a cheat sheets for multiple nested groups, one has to define separate cheat sheets for each sub-group, link those together, and then link those to plugin cheat sheet definitions. At each level, you create and maintain names and IDs. So for one group, we need:

  • Parent cheat sheet name and id

  • Parent cheat sheet file name

  • Group name

  • Child cheat sheet names

  • Plug-in id, name and client link.

If you decide to change the name of one cheat sheet, that can can be one file name, three separate files, and seven text entries to maintain! For me this also creates a lot of cognitive dissonance. Coordinating these kinds of artifacts is a common problem in software design, especially within a large pluggable set of tools, but I think it comes up quite a bit in Eclipse infrastructure. I'll pick up on that general theme below. I'll also talk about how I think the user experience could be improved.

Connecting it all Together


One of the coolest and least appreciated aspects of bundled documentation is the ability to make the documentation interactive. You can call commands or refer to existing cheat sheets.

Calling commands from Help


If I'd known how easy this was, I would have done it much earlier. Something else you really should try, as it provides a nice solution that sits between cheat sheets and screenshot oriented tutorials in the suer experience. In my case, I thought it would be neat if user's could actually run example models while reading about them in the Documentation! So, here's how to call code directly from help.

First you implement a live help action:

public class ExecuteJavaModelAction implements ILiveHelpAction {

String javaPath;

/**
* Launch the Escap model.
*
* @see java.lang.Runnable#run()
*/
public void run() {
IPath path = new Path(javaPath);
EclipseEscapeRunner eclipseRunner = new EclipseEscapeRunner();
IProject javaProject = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
IPath fullPath = path.removeFirstSegments(1);
try {
javaProject.open(null);
eclipseRunner.open(javaProject, fullPath.toPortableString(), fullPath.lastSegment());
} catch (CoreException e) {
throw new RuntimeException(e);
}
}

/**
* Define the Java pah to the model node.
*
* @param data
* @see org.eclipse.help.ILiveHelpAction#setInitializationString(java.lang.String)
*/
public void setInitializationString(String data) {
javaPath = data;
}


Here, since I need to refer to a model within a project within the workspace, I need to discover where that workspace and project are. Otherwise the code is very straightforward.Then, we just need to define an embedded javascript to actually execute it:

<a href='javascript:liveAction("org.eclipse.amp.escape.ide", "org.eclipse.amp.escape.help.ExecuteJavaModelAction",
"org.ascape.escape.models.brook/edu.brook.sugarscape.GAS_II_1")'>


This is covered nicely in the Eclipse help (as one would hope it would be!) though why not have a working example here!

Calling Cheatsheets from Help


It's pretty easy to get to Help from Cheat Sheets, but what about getting from Help to Cheatsheets? It's actually pretty easy though for some reason it was at first opaque to me and isn't actually spelled out in Help anywhere. Instead it's one of those things where you have to put two and two together but it can be difficult to locate where those two twos are to begin with. So here is how it is done:

Please follow this <a href='javascript:liveAction("org.eclipse.ui.cheatsheets", "org.eclipse.ui.cheatsheets.OpenCheatSheetFromHelpAction",
"org.eclipse.amp.escape.loadProjects")'>cheatsheet</a>.


But cheat sheets still have some significant usability issues I think -- and like the other issues, they aren't really technical, but have to do with the overall design approach.

Hey, I still can't open this can!


Which brings us back to my reason for resurrecting this post. It's that whole can opener thing. The Eclipse user assistance capabilities, especially when compared to what's available on many platforms is quite complete. Overall, the Eclipse toolset and User Experience provides a powerful, world class set of user tools. There have been enormous efforts in improving the User Experience, most especially I think with provisioning -- but I still think we can do better. For example, it's hard to explain exactly why, but somehow the Eclipse User Assistance experience still seems a bit disjointed.

Part of making the most of the tools is for all of us to (yeah, obvious, right) use them, and that means I think improving the tools for authoring and integrating help so that small teams can get up to speed on them quickly to produce good help. But part of it is being willing to rethink aspects of the user experience. And thinking clearly and in an unbiased way about how all of the different pieces fit together.

How do we do that? I don't know exactly, but I've observed that one of the biggest challenges to the improvement of Eclipse is this attitude: "We've always done it that way, and it makes sense to me.." Well, of course it makes sense to you, you've been using the tool for five years! Then it's, "Ok but, no one has ever complained about it, they should file a bugzilla". The last feedback you're going to get is from new users -- they don't know how to use the software, so how likely is it that they're going to know the culture of bug reporting? And so here's the problem with that response: new users don't complain, they just go somewhere else. Or, if they stick around, they quickly learn that that is just the way things are done and its not likely to change, because everyone is used to it. And more than anything else -- which constantly surprises me, knowing how imperfect most software really is -- they figure that they're just missing something that must be obvious to everyone else!

Which is why I love the Bug that I mentioned at the beginning of the post. Here's a user that didn't get it, and let us know that he didn't get it. Now, I know Scott and he's not a dumb guy. He's actually a really smart guy -- a Computer Science Ph.D. and just finished a postdoc at Caltech. And he's done a lot of development for ABM tools based on Objective C on OS X. So what's he missing? The issue he is having here is being directed to a cheat sheet from the welcome screen.

The Eclipse developer (me) and platform (us) point of view: I've put together a great Welcome setup, and even included some sample models. All the user has to do is click on the Samples button, click on the Example Models button and he get's directed through the simple process of downloading and installing some example models from the version control system. Neat, huh?

Scott's point of view: I clicked on a button and the window went away and nothing happened.

Now Scott didn't know that he was being asked to use a cheat sheet. The Welcome screen just tells him that he's going to be able to load some example models. Well, if you've done this before, you know that you're gong to get a cheat sheet and you just need to follow the steps that are layed out for you. Once you know what a cheat sheet is, it's pretty clear what it's for. But what if you've never used one before? Cheat sheets actually open into a small window on the right side of your screen. They're surprisingly easy to miss. Not for you and me, but for a new user. Worse then all of this, loading some of the models (the one's I can't host on Eclipse for licensing reasons) requires SVN, and (as all long-time Eclipse users are only too painfully aware) if you haven't installed Subversion yourself, it won't work, and you won't know why. So even if the Cheat Sheet were obvious it still wouldn't work out of the box. Which means that I need to add something to the cheat sheet that says "First you need to install Subversion..". Argh! I think it will actually be easier to just move the example models.

Perhaps you have other User Experience examples to share. It's always a bit difficult to share examples because you end up critiquing a small aspect of work that someone has put a great deal of effort and thought into. But doing so is critical to having a culture of continual improvement. In that spirit, here are a couple of examples I've gleaned from users..

What's the difference between Help Contents and Dynamic Help? And where does "Search" fit into that? Another one is the Eclipse downloads -- there have been improvements to the download page itself, but I still get questions all the time from users asking me what version of Eclipse they should download. Hey, that's easy, right? OK, for the Eclipse developers out there, we can find anything we need quickly and easily, but please imagine for a minute that you are a new user facing this matrix of choices. Now, there are all kinds of good rationales for not changing things -- (yep) that's the way we've always done it, and conversely the users need to learn to use what we're trying to give them, and -- but I'll go out on a limb and say that user experience trumps pretty much every one of these.

Perhaps you've got some ideas you'd like to share. Or perhaps I'm making a mountain out of a speed bump on the entrance ramp to the exciting world of Eclipse, but I'll just suggest that before you think "that's obvious" put your self in the mind of a new user. And then ask yourself "is that really obvious, or am I just used to it?"


Bob Balfe
Bob Balfe

New Attachment viewer with ODF thumbnails and JAR file support

As promised in the last post, here is a new updated widget for the attachment viewer. You can download the latest source files from the OpenNTF project.  If you want to learn how to install this into Notes 8.5.1 and above check out the video I posted to show how to do that.

Here is a summary of the support and you can also watch a video here or below:

- ODF thumbnail support added, .odp, .odt, .docx, .dotx, .docm, .dotm, .xlsx, .xlsm, .xltx, .xltm, .pptx, .pptm, .potx
- Modified Zip file to limit embedded text files to show only first 20K
- JAR file support – extended the ZIP provider to include Jar files
- New Text File support – .mf, .properties


Ankur Sharma
Ankur Sharma

Headless Build for Beginners - part IV

Customizing the build

Not always we want the build to happen according to the out-of-the-box scripts.In fact, customizations are almost always needed - be it fetching the sources or the way we wish to assemble them. PDE Build provides a set of templates which can be used to hook in the customize (add to and/or override) the default behavior.

These templates are available in PDE Build plug-in (inside templates\headless-build folder of org.eclipse.pde.build_<version><qualifier>). The scripts and templates are one the main reason why PDE Build plug-in is a directory and not a jar.

The purpose and usage of these templates have been explained nicely in Eclipse help under the topic Customizing a Headless Build.

These templates are
  • customTargets,xml
  • allElements.xml
  • customAssembly.xml
In short, the customTargets.xml have various pre- and post- ant targets that build.xml (or productBuild.xml - in case you are building a product) calls before and after each process (like setup, source fetch, build, assemble, package, etc). Similarly, the targets in allElements.xml and customAssembly.xml gets delegated for various jobs.

To use these templates we need to copy them in the build configuration directory (c:\build\buildConfiguration in our example) where we stored build.properties file in previous steps. And then modify the appropriate targets. This is what we will do for building an update site in next step.

Lars Vogel
Lars Vogel

Save your local Mylyn tasks

If you are using Eclipse you properly using Mylyn. I recently got a new machine and wanted to migrate my local Mylyn tasks from one computer to another.

Local tasks stored in your workspace in .metadata/mylyn/tasks.xml.zip. The context for local tasks stored in .metadata/.mylyn/contexts… look for files labeled local-X.xml.zip, these have the context. You can back up the entire Mylyn data directory and put it into the same place on your new computer.

Worked well for me!

Thanks to David Shepherd for the tip via twitter.

 

Neil Bartlett
Neil Bartlett

OSGi Compliance Levels

Almost every week, I hear about new and existing Java libraries or frameworks becoming “OSGi Compliant”. This makes me happy as it indicates the traction that OSGi is getting as a platform. The only problem is that “OSGi Compliant” could mean almost anything… and therefore it means precisely nothing.

For example, many libraries can be easily used in OSGi even if they don’t provide an OSGi descriptor (i.e., a MANIFEST.MF containing Bundle-SymbolicName etc.), so long as they steer clear of certain problematic coding patterns such as classpath scanning, unconstrained use of Class.forName() and so on. Such libraries could reasonably be termed “compliant”. But another framework may have been deeply integrated into OSGi so that it can make use of services, receive configuration through Config Admin, and so on.

It seems that we need a vocabulary that will help us distinguish these two cases, and those in between. We need to define, at least informally, some kind of Beaufort Scale for levels of OSGi compliance (if you’re feeling uncharitable towards OSGi you may prefer to call it a Schmidt Pain Index).

The purpose of the exercise would certainly not be to admonish authors of libraries that rate near the bottom of the scale, nor to congratulate those at the top. Rather, it would help authors to communicate the depth of their support for OSGi in a more precise way, and it would help the OSGi community communicate to library authors how they can make their products more useful to us.

To get the ball rolling, here are my initial thoughts. I do this merely to invite feedback rather than to attempt to impose my own classification.

Level Name Notes
-1 Non-compliant. Difficult or impossible to use in OSGi. May be possible to use via an adaption layer or patching of the sources or binaries. For example, the library may rely on classpath scanning or invalid assumptions about the classloading hierarchy.
0 Neutral. Ships as a plain (i.e., non-bundle) JAR, but can be used straightforwardly in OSGi if wrapped as a bundle or added to Bundle-ClassPath.
1 Compliant Shipped as one or more OSGi bundles with correctly defined MANIFEST.MFs. All dependencies are also Compliant and either shipped with the library or available separately from a repository. Package versions follow the Semantic Versioning guidelines (pdf warning).

For many libraries, there is no need to go any higher than level 1. The higher levels are applicable to frameworks, which are more complex and may feature extensibility through plug-ins, custom configuration, logging, etc. Obviously I would like to see all libraries reach at least level 1, but the OSGi community needs to do more to make this easier.

Level Name Notes
2 OSGi-Assisted The framework is aware of OSGi, either in its core or via optional modules. Areas of the framework that are open to extensibility can use services for this, in addition to other mechanisms. The framework can cope with service dynamics without restarting the JVM.
3 OSGi-Powered The framework is based on OSGi. It publishes services that may be used by other parts of our system. Its own services may be replaced by our own service implementations. It takes advantage of standard OSGi services such as Log Service, Config Admin, Event Admin, HTTP Service. However, despite all this it may still provide a way to run in non-OSGi environments.

A key concern for many frameworks as they seek to rise this pyramid is to remain usable outside OSGi, which is a goal I support. There appears to be very little information available on how to develop frameworks that are able to take advantage of OSGi without introducing a hard dependency on it. This is something I hope to remedy in future posts.

What do you think of this taxonomy? Is it useful, or a waste of time? Should there more levels, or fewer? Please comment below, or link to your own blog.

UPDATE Christian Baranowski blogged some thoughts about independent verification of bundle compliance. That’s a great idea, but my initial goal is less ambitious, i.e. simply to allow library authors to assert something meaningful about their level of OSGi compliance. I think that is a prerequisite before looking to verify those assertions.

UPDATE 2 BJ makes some excellent points in the comments below, which I entirely agree with. Be sure to scroll down and take a look.

Ed Burnette
Ed Burnette

"I am not a villain," says alleged Android Trojan creator

Max Lifshin, an Android developer living in Russia, says his Tap Snake program is not a Trojan or virus, despite a warning from security software maker Symantec last week. Lifshin has been vilified in the press for releasing the program, which was intended for parents to track their children’s whereabouts. Reached by ZDNet for comment, Lifshin insisted that his motivations were innocent:

The app is no more malicious than a motion detection camera - everything depends on the user’s intentions. It gives all the proper warnings and requires a set up, a conscious action, to report location. It can be easily used by mothers worrying about their kids’ whereabouts. In fact, I suspect the majority of users were indeed the mothers.

For the program to work, the parent or guardian downloads and installs the innocuous looking game on their kid’s phone. During the installation process, Android asks for permission to access location information and to send and receive information to the Internet. After accepting these terms, the parent must open up a menu option and activate the tracking service with a unique key. Then they give the phone back to their child. From that point on, the game will occasionally upload its location to a server, where only somebody with the key can view it. Lifshin says:

The app is not really very different from Google’s Latitude. As any technology product, it can be put to either noble or malicious ends.

The game can be uninstalled at any time. The program run by the parent to view location information is called GPS Spy. The Market description for GPS Spy openly explained how all this works, saying:

Download and install the free Tap Snake game from the Market to the phone you want to spy on. Press MENU and register the Snake with the service. Use the GPS Spy app on your phone with the same email/code to track the location of the other phone.

However, the description of the Tap Snake game did not say anything about tracking, presumably so your child could look up the game for updates or reviews and be none the wiser. Until recently, Tap Snake was a free download and GPS Spy was $4.99. After the news came out, Google removed both apps from the Market. According to Lifshin,

What’s sad is that these “whistle blowers” have prompted Google to suspend the app and thus deprived me of income. They unfairly classified this app as a Trojan and portrayed me as a villain, a malicious Russian developer working in the shadows.

What do you think: is this a dangerous Trojan or a useful safety device for parents? Was Google right to ban it? Speak up in the Talkback section below.

August 23, 2010

Bob Brodt
Bob Brodt

LaMiPU (Part 2)

Any resemblance to real applications, living or dead, is purely coincidental…

My previous blog, described a business problem based on a case study by Intalio and one of its business partners. Before I go any further I should probably clarify the purpose of this blog, lest I be sued for misrepresentation.

DISCLAIMER

The case study and accompanying implementation presented here, while it may make references to actual implementations and case studies published by Intalio and/or its business partners, is entirely my own work and does not in any way intend to represent any actual original work performed by any business entity, anywhere on this planet or any other time/space continuum.

The reason for this blog is to promote BPEL technology by teaching web service integration concepts based on real-world implementations, using BPEL as the orchestration tool, and not to rip off other people’s work. The actual implementations presented here are based solely on my observations, Gedankenexperiments and reverse-engineering of these real-world business problems and their solutions.

I do not claim to be a Subject Matter Expert in the area of airline reservation systems, and the existence of any supporting systems described below is pure speculation on my part (based on life experience, internet searches and just plain pulling stuff out of thin air to suit my needs). The actual availability, behaviour and capabilities of these systems may be much different than postulated here. As stated, the focus is on BPEL and web service orchestration, and any of these supporting services and resources will be “stubbed in” wherever necessary to present a working end-to-end solution.

There, I think that just about covers it. Now let’s have some fun…

Identifying the Resources

As mentioned in the first instalment of this series, the primary design goal is to use open source software whenever possible and resort to rolling our own only when necessary. This means that we’re going to use:

    • Eclipse BPEL Designer and Eclipse IDE

    • Eclipse WTP

    • Riftsaw BPEL runtime

    • Jboss Application Server

    • some Jboss-compatible WS stack (native or CXF)

    • JAX-WS for generating java services and clients

To make all of this happen there are quite a few services and database resources that need to participate. At a minimum, we will need the following:

  • Seat Availability Notification System (SANS) - this is the “client” that kicks off the entire process, although the Flight Reservation System may already have this data available. Starting at one hour before the scheduled departure time, this system needs to send messages to the LaMiPU process, one for each premium seat still available for that flight. Since the response from LaMiPU may take several minutes (depending on how long the customer interaction takes), this will have to be an async request/response. LaMiPU will respond with either “accepted” or “rejected” indicating whether the customer has accepted or rejected the seat upgrade. The process may also respond with a fault under certain situations (e.g. if the flight has already departed). If “accepted”, the client marks the seat as “occupied”, and the seat previously occupied by the passenger (presumably an “economy” seat) as available. This economy seat can then be made available to stand-by customers, but that’s out of scope for this project. Most likely this client is specific to the airline and will likely have to be cobbled together from existing resources.

  • Flight Reservation System (FRS) – this service returns the passenger list for a given flight. Passenger status includes whether or not they have already checked in for a flight.

  • Flight Scheduling Service (FSS) – this service returns the scheduled departure time for a given flight. A quick internet search for web services that already offer this functionality turns up quite a few hits, in particular: http://flightaware.com/commercial/flightxml/documentation2.rvt Not that our solution will use this service (because I didn’t want to be on the hook for subscribtion fees just so I could blog about BPEL) but it does provide a blueprint for an existing API that we can use. The airline will probably already have their own system, or subscribe to one.

  • Frequent Flyers Database (FFDB) – this system is used to look up checked-in passengers and find our “loyal customers”. Hmm, since we’re going to be using Riftsaw which is based on Apache ODE maybe we can take advantage of JDBC mapping of BPEL variables. Of course we’ll have to write a BPEL Editor extension to deal with this (another shameless plug for a future blog topic ;) )

  • Credit Card Authorization System (CCAS) – used for credit card authorization and billing for upgrade fees. There are tons of these available, and the airline will have one or more which it uses regularly and which may already have a WSDL interface; our system just needs access to those services.

  • IVR System – this is the fun stuff :) check out http://trixbox.org LaMiPU will use IVR for interaction with passengers so we’ll write a web service using a top-down approach to building a java application. Hopefully we can get the text to speech feature working.

The Work flow

Here’s the basic sequence of events, disregarding possible failure or exception conditions for the moment:

  1. SANS client sends messages to LaMiPU, one for each available seat
  2. This message starts a LaMiPU process, using the flight# and seat# as the correlation key.
  3. LaMiPU sends a message to the FSS requesting departure time for the given flight#. If it’s too late to get the seat reassignment done before departure, LaMiPU replies to SANS with a fault message.
  4. LaMiPU contacts the FRS to get the list of passengers that have already checked in for a given flight.
  5. For each of the passengers returned in 4 that do not already have a premium seat assignment (business or first class), LaMiPU searches the FFDB for those passengers. If the FFDB indicates that the passenger has not already received a seat upgrade offer for this flight, LaMiPU prepares to contact that passenger using the IVRS. If there are no more passengers to contact, a fault is returned to the SANS client. NOTE: we could modify this logic a bit by offering seat upgrades to regular passengers at a much higher premium, but this is outside the scope of this project. Besides, the point of this exercise is not to sell out all premium seats but to demonstrate as many BPEL features as possible ;)
  6. For the passenger returned by 5, prepare a seat upgrade offer message for the IVRS consisting of the passenger’s name, the flight# and the price for the upgrade.
  7. If the passenger accepts the offer, bill his/her credit card and notify the FRS of the seat assignment change, wait for a response and send a verification message to the customer. Also update the FFDB to indicate that the customer has been contacted and accepted the seat upgrade. This becomes “interesting” information for marketing, and may lead to follow-on work to enhance the system ;). Finally, send a message back to the SANS with “accepted” status.
  8. If the passenger declines the offer, update the FFDB to indicate the customer has been contacted but has declined the upgrade. Send a message back to the SANS with “rejected” status.

This is just the basic “happy path” flow. Keep in mind that there are all kinds of failure modes here which have to be dealt with. I’ll get into these in more detail in my next blog.

Doug Schaefer
Doug Schaefer

Hypervisors drive Heterogeneity


I have put together a pretty neat little lab here under my desk. As I always say, you have to use the tools to understand the needs of the users. You have to get into their shoes and see what you like and don't like. Then you have a good chance of building tools they'll actually use and like.

My lab includes two "embedded" systems on the right. The top is a board that has a Freescale PowerPC P4080 8-core chip in it. I have attached my Wind River ICE JTAG unit to it to test some really heavy duty multi-core scenarios. On the bottom right, I have what looks like a basic PC, and it is, but it runs Wind River's hypervisor hosting three operating systems: Wind River Linux, vxWorks, and of all things Windows. I don't have the P4080 system booted up yet, but my intention is to run the Hypervisor there too with random combinations of wrLinux and vxWorks.

As I put this together, it really drove home the need for an IDE platform that is heterogeneous. That's a hard word to pronounce, but what I really mean is an IDE that can target any operating system that can run in a hypervisor configuration, which is pretty much all of them. And that means an IDE that has plug and play support that lets you create the source for applications that can run on them all, build that source for any and all of the target platforms, and debug the application as it runs on one ore more of them.

And, you guessed it, the Eclipse CDT C/C++ IDE is a great platform to do that with. We have build and debug support for the GNU toolchain for Linux and from Wind River we have commercial support for vxWorks and Wind River Linux, and upcoming in the next release of CDT, we'll have support for Microsoft's Windows SDK which includes Visual C++.

As well, I'm about to embark on a very interesting journey with the Target Communication Framework as we advance it's debug capabilities to cover all of these platforms as well. With a common framework for agents that run in all these environments, we'll have the ability to plug 'n play capabilities into these agents and come up with tooling we haven't even dared to consider before. Am I pumped about it? You betcha. We've long had the advantage of plug-in architectures with our Eclipse-based tooling, and now we'll get that advantage all the way down to the target as well.

And it's really these hypervisor scenarios that have brought me here. It's finally a concrete example where you really need the heterogeneous capabilities that have driven my work on the CDT. And, it's something to sell our employers with too :).

Sven Efftinge
Sven Efftinge

Xtext 1.0.1 (SR1) release and git migration on Wednesday

In the last two months Xtext got a great number of performance and memory footprint improvements, bug fixes and extensive documentation enhancements (most of them done by Sebastian while us others were on summer vacation :-)). We also fixed a couple of annoying bugs in Xpand's editor.

You can find a detailed list of all 89 fixes in this bugzilla query.

The upcoming Xtext 1.0.1 (Helios SR1) release will be built on Wednesday.

Migration to git
We are also happy to announce that this will be our last CVS based release, since we will switch to git on the very same day. I also want to thank Ralf Ebert for his excellent git training he gave us last week in exchange to an Xtext training. Git is cool! :-)

Bob Balfe
Bob Balfe

Why BrowserFunction is so cool

If you are familiar with the embedded browser in the Lotus products you may or may not have heard of BrowserFunction, most likely not!  The problem is this class is not very well documented and was part of E4 and is scheduled for Eclipse 3.6.  Notes 8.5.2 does however support this SWT class so you can begin to play with it once 8.5.2 is available.

Why is this so important?  Well, just imagine, now you can completely communicate between Java and JavaScript using this.  You can use the SWT Browsers execute() or evaluate() methods to execute JavaScript from Java and now you can execute Java from JavaScript using BrowserFunction.

This implies you could potentially write all of your UI using HTML/CSS/JavaScript technologies!

The Attachment viewer is such an application, you can check out the code on OpenNTF.  I don’t use the BrowserFunction in the OpenNTF version but I have already begun to make an Lotus Notes 8.5.2 version of the plugin that has much better integration with the Notes client.  If you are writing side bar plugins and want to standardize on writing in a single technology you should check out the SWT Browser and the BrowserFunction support.

EclipseLive
EclipseLive

Reminder - Eclipse 4.0 - the Next Generation of the Eclipse Platform

Boris Bokowski (IBM)
 
Abstract:

As the software landscape changes, the Eclipse platform is also evolving in order to remain relevant and vibrant. Eclipse 4.0, the next generation of the Eclipse platform, arrived this summer. The goals of Eclipse 4.0 are to simplify the Eclipse programming model, enable the platform for use on emerging web-based runtime technologies, and broaden participation in the development of the platform.

Join Boris, lead of the Eclipse 4.0 project, for an overview of Eclipse 4.0 and a demo of some of the features which benefit users.

Total running time will be approximately 1 hour

8:00 am PDT / 11:00 am EDT / 3:00 pm UTC / 5:00pm CEST - Convert to other time zones

Thanks to Adobe for contributing their Adobe Acrobat Connect product to host this webinar.


delicious delicious | digg digg | dzone dzone

Eclipse Riena
Eclipse Riena

Progress in a new bar

For a small scrum tool that we are currently developing on top of the Riena framework, we wanted to visualize the progress of user stories and tasks carried out by a developer. We would usually use a ProgressBar widget to display such a progress. However, as we soon realized, this widget has a number of drawbacks.

A ProgressBar is usually used to display the progress of a much shorter time span, a file operation for example. This assumption found its way into OS design decisions. For instance, since Vista, the ProgressBar on Windows features a highlight perpetually running back and forth to indicate that the process is still running. This is rather irritating when several ProgressBars are used on one view. Also, if a ProgressBar was hidden due to a scrolling operation and comes back into view, it gradually fills up to the value currently set. As with many other SWT widgets, the possibilities to alter color or design are very limited. We wanted to change the color when a task is completed to indicate the difference between “the estimated/allotted time has been used” and “the task has been completed”.

Long story short, we wrote a new widget, the StatusMeter. It dynamically creates an image, giving us absolute control over all its properties.Current state indicated by the new ProgressBar We now can change the color to reflect different states. There is a ridget in place so it feels like any other widget used in Riena. And since the main part of this widget is the image, it also gives us the opportunity to use it inside of table columns (for example via Riena’s ColumnFormatter). Thus we can now visualize percentages in table columns just as easy as we visualize boolean values with a checkbox.

The widget is called StatusMeterWidget. If you want to use it in a table column, use StatusMeter directly to create just the image. Both are available via CVS. Feel free to send screenshots of how you use it in your application.

Ankur Sharma
Ankur Sharma

Adding SpellChecking to custom editors

Eclipse provides a nice framework to use spell checking in dialog and editors. Chris has tipped about it here. However, if you are using a custom editor then you have to put few pieces together yourself. Consider an XML editor. We would want the spelling check only for the string in attribute values and not the XML Tags.

Let us try and implement this. We can start with the XML editor template provided by PDE.

1. Create a new plug-in using "Plug-in with an Editor" template.

New Plug-in Wizard
2.  This will create a simple XML Editor by extending TextEditor.

3. The XMLEditor uses XMLConfiguration to set the source viewer configuration.

public XMLEditor() {
super();
colorManager = new ColorManager();
setSourceViewerConfiguration(new XMLConfiguration(colorManager));
setDocumentProvider(new XMLDocumentProvider());
}

Modify the constructor for XMLConfiguration and pass the preference store. It will be needed by its super class.

public XMLEditor() {
super();
colorManager = new ColorManager();
setSourceViewerConfiguration(new XMLConfiguration(colorManager, getPreferenceStore()));
setDocumentProvider(new XMLDocumentProvider());
 
4. The XMLConfiguration basically hooks various listeners, providers and assistants to the Editor. The template generated code will have it sub-classed from SourceViewerConfiguration. Change it to TextSourceViewerConfiguration. The TextSourceViewerConfiguration provides out of the box spell checker, spelling annotation, problem hover text, quick fixes, etc.

public class XMLConfiguration extends TextSourceViewerConfiguration { //SourceViewerConfiguration {
...
public XMLConfiguration(ColorManager colorManager, IPreferenceStore preferenceStore) {
super(preferenceStore);
this.colorManager = colorManager;
}
...

The preferenceStore will be used for checking dictionary and other preferences. They can be set from Window > Preferences > General > Editors > Text Editors > Spelling .

5. Override the getReconciler function. The implementation for getReconciler provided by TextSourceViewerConfiguration uses a SpellingReconcileStrategy. The SpellingReconcileStrategy will spell check the whole document. Since its an XML Editor, only quoted strings should be spell checked and the XML tags should be skipped.

/**
* Providing custom XMLSpellingReconcileStrategy to enable spell checking for only strings
*/
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
*/
public IReconciler getReconciler(ISourceViewer sourceViewer) {
XMLSpellingReconcileStrategy strategy = new XMLSpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService());
Reconciler reconciler = new Reconciler();
reconciler.setReconcilingStrategy(strategy, XMLStringPartitionScanner.XML_STRING);
reconciler.setDocumentPartitioning(XMLStringPartitionScanner.XML_STRING);
return reconciler;
}

6. XMLStringPartitionScanner will be our custom document partition scanner to identify the quoted string. The template generated code will make use of XMLPartitionScanner. This class specifies the rules for identifying the XML tags and comments. Since, the quoted string are part of XML Tag only, we can not use this partition scanner. Therefore, we write our custom document partition scanner and at supply it to the reconcile strategy.

public class XMLStringPartitionScanner extends RuleBasedPartitionScanner {

public final static String XML_STRING = "__xml_string";

public XMLStringPartitionScanner() {
IToken stringToken = new Token(XML_STRING);
IPredicateRule[] rules = new IPredicateRule[1];

rules[0] = new MultiLineRule("\"", "\"", stringToken, '\\');
setPredicateRules(rules);
}
}

7. XMLSpellingReconcileStrategy will extend SpellingReconcileStrategy since it already knows how to collect spelling problem, etc. Only reconcile is what needs to be overridden.

public class XMLSpellingReconcileStrategy extends SpellingReconcileStrategy {

public XMLSpellingReconcileStrategy(ISourceViewer sourceViewer, SpellingService spellingService) {
super(sourceViewer, spellingService);
}
...
public void reconcile(IRegion region) {

AbstractDocument document = (AbstractDocument) getDocument();
IDocumentPartitioner docPartitioner = document.getDocumentPartitioner(XMLStringPartitionScanner.XML_STRING);

IAnnotationModel model = getAnnotationModel();
if (region.getOffset() == 0 && region.getLength() == document.getLength()) {
//reconciling whole document
super.reconcile(region);
deleteUnwantedAnnotations();
} else {
//partial reconciliation
//preserve spelling annotations first
Iterator iter = model.getAnnotationIterator();
Map spellingErrors = new HashMap(1);
while (iter.hasNext()) {
Annotation annotation = (Annotation) iter.next();
if (annotation instanceof SpellingAnnotation) {
SpellingAnnotation spellingAnnotation = (SpellingAnnotation) annotation;
Position position = model.getPosition(spellingAnnotation);
String contentType = docPartitioner.getContentType(position.getOffset());

if (XMLStringPartitionScanner.XML_STRING.equalsIgnoreCase(contentType)) {
spellingErrors.put(spellingAnnotation, model.getPosition(annotation));
}
}
}

//reconcile
super.reconcile(region);

//restore annotations
model = getAnnotationModel();
iter = spellingErrors.keySet().iterator();
while (iter.hasNext()) {
Annotation annotation = (Annotation) iter.next();
model.addAnnotation(annotation, (Position) spellingErrors.get(annotation));
}
deleteUnwantedAnnotations();
}

}

/**
* Deletes the spelling annotations marked for XML Tags
*/
private void deleteUnwantedAnnotations() {
AbstractDocument document = (AbstractDocument) getDocument();
IDocumentPartitioner docPartitioner = document.getDocumentPartitioner(XMLStringPartitionScanner.XML_STRING);
IAnnotationModel model = getAnnotationModel();
Iterator iter = model.getAnnotationIterator();

while (iter.hasNext()) {
Annotation annotation = (Annotation) iter.next();
if (annotation instanceof SpellingAnnotation) {
SpellingAnnotation spellingAnnotation = (SpellingAnnotation) annotation;
Position position = model.getPosition(spellingAnnotation);
String contentType = docPartitioner.getContentType(position.getOffset());
if (!XMLStringPartitionScanner.XML_STRING.equalsIgnoreCase(contentType)) {
model.removeAnnotation(spellingAnnotation);
}
}
}
}
}

8. Putting it all together

The XMLStringPartitionScanner is our document partition scanner. It uses the MultiLineRule to locate the quoted string. XMLDocumentProvider adds it to the XML document.

public class XMLDocumentProvider extends FileDocumentProvider {

protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] {XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT});
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);

//Adding our string partition scanner to the document
partitioner = new FastPartitioner(new XMLStringPartitionScanner(), new String[] {XMLStringPartitionScanner.XML_STRING});
partitioner.connect(document);
((AbstractDocument) document).setDocumentPartitioner(XMLStringPartitionScanner.XML_STRING, partitioner);
}
return document;
}
}

XMLPartitionScanner is generated by the template and it locates XML tags and comments. Since quoted strings are part of tags, we added XMLStringPartitionScanner too.

The XMLConfiguration finally wires all the content types to PresentationReconciler

9. After thoughts

All the infrastructure is already in place for enabling spell checking. But custom editors need some extra wiring. If finer control is needed on the quick fix assistant override getQuickAssistAssistant function and for controlling the hover message getTextHover will do the trick.

10. Source code


The archived project can be downloaded from here.

11. Disclaimer :-)

This code doesn't cover all the scenarios as it is just an example. These things I figured out while fixing the bug #286203. Feel free to add your suggestions and point out any mistakes you see.Eclipse provides a nice framework to use spell checking in dialog and editors. Chris has tipped about it here. However, if you are using a custom editor then you have to put few pieces together yourself. Consider an XML editor. We would want the spelling check only for the string in attribute values and not the XML Tags.

Steffen Pingel
Steffen Pingel

Preview of Mylyn Hudson connector available

I am happy to announce that EGit is not the only Eclipse project that had a successful Summer of Code this year. Just as the program is wrapping up, a first version of the new Mylyn Hudson connector has been uploaded to the Mylyn weekly incubator update site. I had the pleasure to mentor Markus Knittig who did a great job over the summer in getting the connector into its current state. While there is still quite a bit of work to do, I have already been using the connector on a daily basis to monitor builds.

The Hudson connector is based on the Mylyn Builds framework which provides common infrastructure for integrating build servers with Eclipse. Most importantly it provides a Builds view.

Mylyn Builds View

The view shows the status and health for subscribed jobs. Red indicates a failed build, yellow failed tests and green means a build was successful. The weather icons in the Summary column show how a build has been doing in recent history following the Hudson web interface.

One really neat feature is the decoration of the view icon which shows the overall status when the view is in fast-view mode. When auto refresh is enabled the decoration icon will show a black or red X once a builds fails very similar to how the JUnit view indicates failed tests.

Builds in Fast View

Subscribing to jobs, which are called plans in the Builds framework, is straight forward from the build server properties page which closely follows the settings page for Mylyn task repositories. All selected plans are shown and monitored in the Builds view.

If you feel brave and want try out the Hudson connector add the following P2 repositories to Eclipse 3.5 or later:

http://download.eclipse.org/tools/mylyn/update/weekly
http://download.eclipse.org/tools/mylyn/update/weekly/incubator

Note that the connector is still work in progress and it is likely that the data model will change in future versions possibly requiring re-configuration of servers. I recommend checking the weekly Mylyn New & Noteworthy every once in a while which will lists any significant enhancements or changes.

The Mylyn Bugzilla lists plenty of ideas how to move forward but I would love to hear from the community what features would be most valuable to you. Please feel free to file bugs against Mylyn or chime in on the discussion on one of the existing feature requests.

There has been talk about moving the Hudson connector in its own Eclipse sub-sub-project. Please drop me a line or comment on bug 308040 if you are interested in getting involved.

August 22, 2010

Robert Konigsberg
Robert Konigsberg

Presenting the Google/Eclipse/Enterprise talk in Reston VA Oct 13

Brief note: I'm excited to be presenting the talk "Eclipse in the Enterprise: Lessons from Google" at Eclipse Enterprise Days on Oct 13 in Reston, VA.

This looks like a great conference for people who support large Eclipse user bases -- you know who you are -- if you attended the Eclipse in the Enterprise BoF at EclipseCon, this conference is for you. From the conference page:

"Attendees must be an employee or contractor of an "Enterprise User" of Eclipse technology. Enterprise users typically are responsible for the use of Eclipse by hundreds and even thousands of developers in their organizations."
Are you planning to attend this conference? Let me know.

Dave Carver
Dave Carver


Sometimes we try to take the short cut when creating our Interfaces and methods. For example, take the IWorkspaceRoot.delete method for an example.

It takes several different parameters:

delete(boolean deleteContent, boolean force, IProjressMonitor monitor);

Most of the time this is implemented in code as the following:

workspaceRoot.delete(true, false, new NullProgressMonitor());

It's a little difficult to understand just by looking at it without looking at the javadoc what it is doing. The more parameters we add the more possibility for mistakes and more complicated the method's code. There is a mindset that boolean parameters should be avoided. That it is better to be more descriptive and create a few more method names:

So instead of the above we could have the following specific method names.

deleteAll(IProgressMonitor monitor);
delete(IProgressMonitor monitor);
forceDeleteAll(IProgressMonitor monitor);
forceDelete(IProgressMonitor minitor);

Yes it is four methods now, but each serves only one purpose. The other method was doing at least four things depending on how the switches were set. I'm sure others could come up with even better method names than I have. It is important when we are designing API and interfaces to look at it from a user's point of view. If it isn't clear from just looking at the method and its parameters what it is doing, then the method is too complicated and doing too much.

August 21, 2010

Matthias Sohn
Matthias Sohn

EGit History View showing all branches

So far EGit’s History View could only display the commits reachable from the current HEAD.

Here how this looks for the git.git repo when the branch remote/maint is checked out :

git.git repo in EGit history view, origin/maint checked out

git.git repo, origin/maint checked out

Jens Baumgart today added a little toggle button which will do all the magic :

Together with my still pending change http://egit.eclipse.org/r/#change,1359
to also show all remote tracking branches this becomes “gitk -all for Eclipse” :

git.git in EGit, showing all branches, branch origin/maint checked out

git.git in EGit, showing all branches, branch origin/maint checked out

August 20, 2010

Birt World
Birt World

BIRT Flash and Gadget Scripting

In my last post I blogged about how Chart Scripting works in BIRT. If you are using Actuate BIRT, you also will have access to Flash Charts and Gadgets. Scripting for these two report items is very similar to the standard Chart scripting model.



Flash Charts
Currently Flash charts support 14 script event triggers that can be hooked to make chart modifications.



The event firing order is shown below.



As you can see the order is very similar to that of normal BIRT charts. The before and after dataset filled events are fired first for each dataset (category and value). Next the beforeRendering event is fired and then the before and after draw series events are fired for each series. Between the before and after draw series events the before and after draw data point events are fired for each point in the series. The before and after draw series events (and the events contained in them) are fired for each series in the chart. After all series are processed, the before and after draw effect events are fired for each effect in the chart. Effects can be used to alter the chart at runtime, allowing font manipulation, blurring, glowing, shadowing, beveling, and animation of different objects of the chart. Effects are added to the chart using the effects editor.



Using the beforeDrawEffect event script you can alter any of the effects added to the chart. For example to turn off the shadow effect in the above chart you could use the following script.



function beforeDrawEffect( effect, fcsc )
{
var effectName = "MyTitleEffect";
if ( effectName.equals( effect.getAction().getName() ) ){
if( effect.getAction().getShadow() != null ){
effect.getAction().getShadow().setEnabled(false);
effect.getAction().getFont().setEnabled(false);
}
}
}



The getEffect().getAction().getName() call returns the name of the effect as defined in the effect editor. This can be used to determine which effect definition your script is operating on. The getAction allows access to the different effect features. Note that if the effect is not enabled the getter method for the effect will return null. In the above script we first check to see if the getShadow method returns null before turning it off.

Finally the afterRendering event is triggered.

These events function much the same way as described in my earlier post. You will notice that event function prototypes are just a little different. For example instead of a chart and icsc parameter you will get a flashChart and fcsc parameter in certain events. For practical purposes these are just extended chart and icsc objects and still provide most of the standard object features. For example to set the chart title to the value of a report parameter using the reportContext, you could use a script like the following.



function beforeRendering( flashChart, fcsc )
{
var parmChartTitle = fcsc.getExternalContext().getScriptable().getParameterValue("MyChartTitle");
flashChart.getChart().getTitle().getLabel().getCaption().setValue(parmChartTitle)
}



Flash Gadgets
BIRT Flash Gadget report items are used to display data in a unique dynamic graphic. Currently Actuate BIRT supports thermometer, cylinder, bullet, spark line, meter gauge or linear gauge gadgets. These gadgets also support server side scripting.



Twelve event triggers are supported and can be used to alter how the gadget is displayed. The events that are triggered will depend on the gadget and which features the gadget is using. For example this meter gadget:



Produces the following event order.



The beforeRendering event is called first and can be used to modify the flash gadget before it is rendered. Next before and after draw region events are trigger for each of the three regions in the meter gadget. This gadget contains two thresholds, so the before and after threshold events are triggered next for each threshold. The gadget also contains two needles so the before and after draw needle events are fired. The threshold label contains a font effect and the threshold areas are animated. This produces before and after draw effect triggers for each. Finally the afterRendering event is triggered.

Retrieving Gadget Values
BIRT Flash Gadgets use value definitions to link the gadget to a BIRT dataset. The definitions are assigned in the Gadget Editor. The runtime values for these definitions can be retrieved in script using the gadget object. For example, in the beforeRendering you could use the following script:


function beforeRendering( gadget, fgsc )
{
var vals=gadget.getResultValues();
for( i = 0; i < vals.size(); i++ ){
if( vals.get(i).getValue() > 20 ){
//do something
}
}
}


The number of result values will depend on the gadget. For example, In a Spark Line gadget there will be multiple values. In a meter gadget, there will be a result value for each needle value.

Region Events
You can customize the colors, transparency, labels, and range values of any region using the beforeRendering or beforeDrawRegion scripts. See the example below.


function beforeDrawRegion( region, fgsc )
{
if( region.getLabel().equals("A") ){
region.setColor("00ff00");
}
//Display value range of region.
region.setLabel( "(" + region.getStartValue() + ", " + region.getEndValue() + ")" );

}

function beforeRendering( gadget, fgsc )
{
//First Region
gadget.getRegion().get(0).setEndValue(25);
//Second Region
gadget.getRegion().get(1).setStartValue(25);




Threshold Events
Thresholds, like regions can also be customized using script. Virtually anything that is set in the designer can be changed in an event trigger. For example:


function beforeDrawThreshold( threshold, fgsc )
{
if( threshold.getLabel().equals("MyThreshold") ){
threshold.setShowValueInside(true);
threshold.setShowValueOnTop(false);
threshold.setStartValue(10);
threshold.setColor("0000ee");
// Display the value range of threshold.
threshold.setLabel( "(" + threshold.getStartValue() + ", " + threshold.getEndValue() + ")" );
}
}

function beforeRendering( gadget, fgsc )
{
gadget.getThresholds().get(0).setMarkerColor("ff0000");
}


In these scripts, we change the starting value, color, label and label location in the beforeDrawThreshold. The marker color is also changed in the beforeRendering script.

AddOn Events
BIRT Gadgets support the concept of an AddOn. An AddOn allows the designer to place images, text, and various shapes on top of the gadget. If the gadget contains an AddOn the before and afterDrawAddOn events will be triggered, allowing you to customize the AddOn at runtime. For example, the following script customizes two AddOns.


function beforeDrawAddOn( addOn, fgsc )
{
// Change add-on styles.
if ( addOn.getName().equals("TitleAddOn") )
{
addOn.setLabel( "Meter Gauge" );
addOn.setFontColor( "ff0000" );
addOn.setFontSize( 28 );
addOn.setY( 35 );
}
else if ( addOn.getName().equals( "ArcAddOn" ) )
{
addOn.setFillColor( "ffff00" );
}
}


AddOns can even be created and placed on the gadget at runtime. For example the following script adds a text AddOn to the gadget using the beforeRendering event.


function beforeRendering( gadget, fgsc )
{
importPackage( Packages.com.actuate.birt.flash.gadgets );
importPackage( Packages.com.actuate.birt.flash.gadgets.impl );

// Add a text add-on.
var textAddOn = GadgetsFactory.eINSTANCE.createTextAddOn();
textAddOn.setAddOnType( AddOnType.TEXT );
textAddOn.setName("DescAddOn");
textAddOn.setShowAddOn(true);
gadget.getAddOns().add( textAddOn );
gadget.setZOrderPosition(1);

textAddOn.setLabel("This sample demonstrates how to add an add-on by scripting.");
textAddOn.setX(2);
textAddOn.setY(20);
textAddOn.setFontSize( 12 );
textAddOn.setHorizontalAlignment( HorizontalAlignmentType.LEFT );
textAddOn.setVerticalAlignment( VerticalAlignmentType.TOP );
textAddOn.setWrap( true );
textAddOn.setTextBoxBorderColor("000000"); //Black
textAddOn.setTextBoxBackgroundColor("c0c0c0");
textAddOn.setWrapMaxWidth( 30 );
textAddOn.setWrapMaxHeight( 50 );

}


Needle Events
If your gadget contains a needle, the before and afterDrawNeedle events will be triggered. Using script the needle can be customized. The size, color, shape, and various other properties of the needle can be customized. These events are passed a NeedleWrapper instance, which can be used to get the specific needle type. For example the following two scripts differentiate between a normal gadget needle and a meter gadget needle.


function beforeDrawNeedle( needleWrapper, fgsc )
{
importPackage( Packages.com.actuate.birt.flash.gadgets );
importPackage( Packages.com.actuate.birt.flash.gadgets.impl );
// Change needle styles.
needleWrapper.getNeedle().setShape( Shape.DIAMOND );
needleWrapper.getNeedle().setFillColor("2cf83a");
needleWrapper.getNeedle().setBorderColor("007f00");
}

function beforeDrawNeedle( needleWrapper, fgsc )
{
//Set Needle size to 25%
needleWrapper.getMeterNeedle().setSize(25);
needleWrapper.getMeterNeedle().setBackgroundColor("ff0000");
}



Effect Events
The effect events were described above in the flash charting section.

Several examples used in this post are available at BIRT-Exchange.

Bob Brodt
Bob Brodt

The Eclipse BPEL Designer Project - what’s the deal here?

Unless you have been stranded on a deserted island for the last few years you’re probably aware that JBoss/Red Hat has been making some huge contributions in the middleware technology space, both on the tooling and runtime side. The announcements of JBoss Tools (the community supported edition) and JBoss Developer Studio (the fully supported, enterprise version) represent an impressive offering of developer tools, plug-ins, APIs, UI components and execution engines that make the SOA architect’s life worth living again. The tooling is built on top of the Eclipse Workbench as a collection of plug-ins and is compatible with the current “Helios” release of eclipse.

JBoss Tools combines best-of-breed open source and in-house developed software and packages it all up in a neat little bundle so that you can be reasonably assured all of the pieces are going to play nice together. This is no small feat, considering that some of the bits of open source software have all kinds of different version interdependencies and conflicts, a problem which Eclipse plug-in developers have simply accepted as the price to be paid for the privilege of getting to play with really cool stuff.

One of these components, which “yours truly” has recently become very involved in, is the BPEL Designer project. It seems that while there has been lots and lots of interest in the community for an editor (other than “vi” or “emacs”) that offers not just an enjoyable user experience but also handles validation reasonably well, there has been little progress over the past three years or so. The reasons for the seeming lack of interest in the developer community to contribute to a product that is obviously of great interest, are unknown and unimportant. What is important is that we as a community rekindle the spark and start moving this project forward again.

Because of my previous experience building EMF/GEF editors, middleware and the like, I have [been] volunteered to “take the helm” and try to help in sparking interest in the community. Over the past few weeks, Wayne Beaton has been extremely helpful in making this happen (thanks Wayne!) and, hopefully, in the next few weeks we will see a renewed energy over at eclipse.org/bpel :)

Here are some ideas we’d like to see happen in the near future:

  1. Stabilize the code. It’s “pretty good” currently and will even [almost] build and run on Helios, but there’s always room for improvement.
  2. Start doing nightly or snapshot builds at eclipse.org and make them available to the community.
  3. Migrate the existing CVS repository to Git to ease the pain of source code management.
  4. Get on the eclipse release train. It’s very painful trying to jump a plug-in by more than one major release of eclipse and making sure that we’re always compatible with the current release goes a long way in community acceptance.
  5. Strongly “encourage” committers to use TDD methodologies to ensure code quality: submitting a patch? submit a JUnit or SWTBot test along with it, and get a prize!
  6. Move the project out of incubation and into a top-level project (WTP? SOA? Any takers out there?)

If anyone in the community has any other suggestions, I’d be more than happy to discuss them. We’re always looking for suggestions and help with bug fixes or implementing new features. Please email me at bbrodt@redhat.com, or simply reply to this blog post.

Jeff, Paul & Simon
Jeff, Paul & Simon

Second printing on the way!

I’m pleased to announce that demand for the OSGi and Equinox book has been quite high. Certainly not NY Times bestseller material but in the 6 months since it has been out we have shipped almost 3500 copies. For context, we are told that selling a total of 10,000 copies for tech a book is a very reasonable number so this is a great start.  In any event, the publisher is running a second printing next week as they are almost out of copies. Paul, Simon and I are just finishing up a few editorial changes and corrections to incorporate reader feedback (thanks!) and then its off to the presses.  Again.

August 19, 2010

Karsten Thoms
Karsten Thoms

Tycho build works also for oAW 4.3 projects

Yesterday I showed how Xtext 1.0 projects can be build with Maven Tycho. So why shouldn’t the same setup don’t work for ‘old’ openArchitectureWare Xpand projects? This works like a charm. I took the simple project that the Xpand project wizard creates and added the POM, and it worked! You can download the sample project here. See the POM below, a setup for other oAW Xpand projects should be rather similar.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>p2.osgi.bundle</groupId>
	<artifactId>org.openarchitectureware.example.xpand.tycho</artifactId>
	<version>1.0.0</version>
	<packaging>eclipse-plugin</packaging>
	<name>org.openarchitectureware.example.xpand.tycho</name>

	<properties>
		<version.tycho>0.9.0</version.tycho>
	</properties>

	<build>
		<resources>
			<resource>
				<directory>src</directory>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.sonatype.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${version.tycho}</version>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<groupId>org.sonatype.tycho</groupId>
				<artifactId>target-platform-configuration</artifactId>
				<version>${version.tycho}</version>
				<configuration>
					<resolver>p2</resolver>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.fornax.toolsupport</groupId>
				<artifactId>fornax-oaw-m2-plugin</artifactId>
				<version>3.1.0-SNAPSHOT</version>
				<configuration>
					<workflowEngine>oaw</workflowEngine>
					<workflowDescriptor>workflow/generator.oaw</workflowDescriptor>
				</configuration>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>run-workflow</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<version>2.4.1</version>
				<configuration>
					<filesets>
						<fileset>
							<directory>src-gen</directory>
							<includes>
								<include>**/**</include>
							</includes>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<repositories>

		<repository>
			<id>p2.openarchitectureware</id>
			<url>http://www.openarchitectureware.org/updatesite/milestone/</url>
			<layout>p2</layout>
		</repository>
		<repository>
			<id>p2.eclipse.helios</id>
			<url>http://download.eclipse.org/releases/helios</url>
			<layout>p2</layout>
		</repository>
		<!-- At the moment the Fornax plugin is only available as snapshot -->
		<repository>
			<id>fornax-snapshots</id>
			<url>http://www.fornax-platform.org/archiva/repository/snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>fornax-snapshots</id>
			<url>http://www.fornax-platform.org/archiva/repository/snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>
</project>

Zoltan Ujhelyi
Zoltan Ujhelyi

New features in the Debug Visualisation plug-in

After a month, some bugs from the Debug Visualisation version 0.8.0 have been fixed. Most notably, the incorrect trimming of long titles, and a case, where arcs were incorrectly removed from the graph.

Two minor new features were also introduced: it is possible to turn off name trimming, and the values of variables is now displayed as a hover.

I created a screencast to show these new features (and also some other, as the last screencast was created over a year ago.

(If the embedded video does not show in your feed reader, you can watch it on YouTube.)

Marcel Gorri
Marcel Gorri

Post #12 – Simultaneously running – 19 Aug, 2010 – 13h04 (GMT-3)

Joining an ongoing simultaneous release is something you won’t forget: lots of things to check, lots of things to make compliant, lots of milestones coming up, lots of things to check again for the next milestone… yeah, it’s a bit of a hush, hehehe! But it is a nice, warm feeling when you see things on schedule and even more when the release train ends and your project is there, with all other projects that were steps ahead of you! :)

This happened for Sequoyah from the last months of 2009 to this June, when Sequoyah was adapting from being an incubation project and developing to maturity, to be released together with Eclipse Helios. I am saying most of this for myself, but I don’t think it was much different for my teammates. The hush and the warm feeling are the same!

Now, for Indigo release train, we are in a much more comfortable position, since we are already compliant with lots of those items, and we know a little bit more on how the process works (even though we still come with some newbie questions sometimes, as the guys on cross-project-dev mailing list would easily confirm, hehe). But for this release we already know when we should make our builds available for the aggregator, when will the packages come for us to test, which bugs to merge for the next build, and things like that.

This was actually the reason I started to write this post:
we have joined the Eclipse Indigo Simultaneous Release Train!

As of today, we have our 1.1.0.I20100816-0145 Sequoyah build available for the Indigo aggregator to build the composite repository for the first milestone. We have also made available a new build of the Pulsar plugins, namely 1.1.1.I20100816-0515.

Things will probably change a lot before the RC weeks come next year, but it’s now a much more fun work to do, knowing a little bit of what to expect! I’ll try to share some more of my experience in the weeks to come. If it is not useful for you, maybe you just laugh a little, and that’s fine too! See you around!

(posted by Daniel Pastore)


Chris Aniszczyk
Chris Aniszczyk

Eclipse and GSOC Alumni

The Google Summer of Code program for 2010 has wrapped up recently.

Eclipse participated this year and I’m not sure how all of our projects did, but I can at least tell you how things went with the project I was involved with. I and the rest of the EGit team (mostly Matthias Sohn) mentored Dariusz Luksza in providing some much needed enhancements to the EGit project. Dariusz started out with some smaller items such as adding tagging support but eventually moved on to more complicated endeavors like implementing support for the synchronize view. All I can say is that the project went really well and I recently was proud to nominate Dariusz as a committer.

In the past, there have been other successful transitions from GSOC alumni to committer. It’s even helped some people get jobs! For example, Remy Suen had to endure my mentorship four years ago or so and now he’s having fun working at IBM hacking on Eclipse 4.0 amongst other things. I’m sure there are other examples out there that aren’t coming to my mind at the moment.

In the future, it would be good to see more projects at Eclipse.org involved in GSOC and mentoring students. Just a little of your time can have a positive effect on a student and the open source community as a whole. In my opinion, working with potential contributors and more importantly students, is one of the best things we can do for ourselves within the Eclipse community to keep things vibrant.

Chris Gross
Chris Gross

A World Without Browser Plugins

...scares the hell out of me. Apple recently announced the iPad and unless you're living under a rock you've heard about it and probably the brouhaha over its refusal to allow Flash. Apparently the iPad won't allow any browser plugins. I am scared to hell.

Web/browser-based applications are the future. We will continue to move further away from the desktop. Soon enough, almost all widespread software will be browser-based. Today that means HTML+Javascript, plus Flash, Silverlight, Java or any other plugin-based approach. If Steve Job's has his way, we won't have any plugins. The Open Web crowd want the same. So just HTML and Javascript. Regardless of how you feel about HTML+Javascript today, everyone has to agree that the rate of innovation here is very very slow. The HTML5 mess including the recent spat about video codecs shows us again that Design by Committee is the worst sort of process.

Now imagine a world where this is the ONLY avenue for new innovations in client-side languages and platforms. If we remove plugins this is all we have left. On the client side, there will be no new languages - just Javascript. There will be no new languages to sprout up like Java or Ruby have done in the past decade. Nope - Javascript is the standard. Nobody will have the motivations (i.e. there will be no money in it) or ability to add a new language to the browser standards. And there will be no way around this via plugins.

Steve Jobs certainly has his master plan and hopes to make large sums of money on the iPad and the continuing dominance of the iPhone. But the Open Web folks seemingly come from a more philosophic/political agenda - "The Web Should be Free". What happens when that comes true. What happens when we've successfully prevented all corporate interests from profiting off client technologies on the internet? Then certainly no companies will invest in the client technologies. We've salted our own fields. We've put our sole hope for new innovation in a committee process thats proven itself time and time again, both in general theory and in specific practice of these groups, to be slow and fraught with problems.

Chris Gross
Chris Gross

ReviewMate - the best Code Review editor for Eclipse

We're proud to announce the public beta of ReviewMate, the best (in our opinion) code review tool for Eclipse.

ReviewMate is different from other code review tools because it allows you to add comments right in the context of the code itself. No more entering code comments in awkward forms. Simply highlight a few lines of code, click the Comment button, and your new comment bubble will appear in the right margin.



Thanks to ReviewMate's innovative technique for code formatting, almost any programming language can be handled by the ReviewMate editor. Even formats like HTML and SQL. If you're Eclipse IDE can format the file, so can ReviewMate.

Check out the ReviewMate page on ElementRiver.com and sign up for the free public beta.

Peter Kriens
Peter Kriens

OSGi Community Event Sept. 29-30 in London

Just a small reminder that you still have to register for the OSGi Community Event, September 29-30 in London! We really have a very strong program this year, there are lots of very interesting presentations. From the program it is clear that OSGi is maturing in many verticals of the software industry. From the Appstore for the connected home market to the enterprise application twins Apache

August 18, 2010

Elias Volanakis
Elias Volanakis

Last week in Riena: 3.0 announced, Web support, ESE talks

Here are three recent developments from Eclipse Riena, that you may otherwise have missed:

• Version 3.0 announced – we have updated the development plan, skipping the 2.1 release and shooting straight for a 3.0 release next June (Eclipse Indigo). While we strive to keep the bulk of the APIs unchanged, this move will grant us the flexibility to carefully introduce changes needed to support Eclipse RAP.

You can read the full announcement here.

• Riena goes to the Web – We are excited about having all of Riena run on Eclipse RAP and are stepping up the effort.

navigation 400 Last week in Riena: 3.0 announced, Web support, ESE talks

In the last two weeks we have ported and committed the Riena Navigation to RAP. Thanks to recent improvements in RAP this was a breeze! We also have an automated build for this second platform. Lastly, we have worked to eliminate all compile errors when building against RAP. This should make further development more straightforward.

If you want to follow the effort add yourself on Bug 302893 and read the ‘Riena on RAP‘ page on the wiki.

• Riena at Eclipse Summit Europe - Riena committers are participating at the ESE, November 2 – 4 in Ludwigsburg. We have proposed following talks:

If you are interested in any of these topics: please follow the link and leave a short comment. This will help the organizers decide which talks to approve. Thanks!

Elias Volanakis
Elias Volanakis

Eclipse RAP – What’s new in Helios? (Slides)

Here are the slides from my “Eclipse RAP – What’s new in Helios?“ talk, which I gave at the Bay Area Demo Camp in June. They capture the most interesting novelties of the RAP 1.3 release. You can find even more details in the full release notes.

rap new in helios bd Eclipse RAP Whats new in Helios? (Slides)

I want to thank Oracle and AvantSoft for hosting and organizing the event.

If you are interested in future Eclipse events in the Bay Area, please take a moment to join the Bay Area Eclipse User Group on Meetup.com

Stephan Herrmann
Stephan Herrmann

Object Teams rocks :)

This is a story of code evolution at its best. About re-use and starting over.

During the last week or so I modernized a part of the Object Teams Development Tooling (OTDT) that had been developed some 5 years ago: the type hierarchy for OT/J. I’ll mention the basic requirements for this engine in a minute. While most of the OTDT succeeds in reusing functionality from the JDT, the type hierarchy was implemented as a full replacement of the original. This is a pretty involved little machine, which took weeks and months to get right. It provides its logic to components like Refactoring and the Type Hierarchy View.

On the one hand this engine worked well for most uses, but over so many years we did not succeed to solve two remaining issues:

Give a faithful implementation for getSuperclass()
This is tricky because a role class in OT/J can have more than one superclass. Failing to implement this method we could not support the “traditional” mode of the hierarchy view that shows both the tree of subclasses of a focus type plus the path of superclasses up to Object (this upwards path relies on getSuperclass).
Support region based hierarchies
Here the type hierarchy is not only computed for supertypes and subtypes of one given focus type, but full inheritance structure is computed for a set of types (a “region”). This strategy is used by many JDT Refactorings, and thus we could not precisely adapt some of these for OT/J.

In analyzing this situation I had to weigh these issues:

  • In its current state the implementation strategy was a show stopper for one mode of the type hierarchy view and for precise analysis in several refactorings.
  • Adding a region based variant of our hierarchy implementation would mean to re-invent lots of stuff, both from the JDT and from our own development.
  • All this seemed to suggest to discard our own implementation and start over from scratch.
Start over I did, but not from scratch but from the wealth of a working JDT implementation.

Object Teams to the rescue: Let’s re-build Rome in ten days.

As mentioned in my previous post, the strength of Object Teams lies in building layers: each module sits in one layer, and integration between layers is given by declarative bindings:

Applying this to the issue at hand we now actually have three layers with quite different structures:

Java Model

The bottom layer is the Java model that implements the containment tree of Jave elements: A project contains source folders, containing packages, containing compilation units, containing types containing members. In this model each Java type is represented by an instance of IType

Java Type Hierarchy

This engine from the JDT maintains the graph of inheritance information as a second way for navigating between ITypes. Interestingly, this module pretty closely simulates what Object Teams does natively, I may come back to that in a later post.

Object Teams Type Hierarchy

As an extension of Java, OT/J naturally supports the normal inheritance using extends, but there is a second way how an inheritance link can be established: based on inheritance of the enclosing team:

team class EcoSystem {
   protected class Project { }
   protected class IDEProject extends Project { }
}
team class Eclipse extends EcoSystem {
   @Override
   protected class Project { }
   @Override
   protected class IDEProject extends Project { }
}

Here, Eclipse.Project is an implicit subclass of EcoSystem.Project simply because Eclipse is a subclass of EcoSystem and both classes have the same simple name Project. I will not go into motivation and consequences of this language design (that’ll be a separate post — which I actually promised many weeks ago).

Looking at the technical challenge we see that the implicit inheritance in OT/J adds a third layer, in which classes are connected in yet another graph.

Three Layers — Three Graphs

Looking at the IType representation of Eclipse.IDEProject we can ask three questions:

Question Code Answer
What is your containing element? type.getParent() Eclipse
What is your superclass? hierarchy.getSuperclass(type) Eclipse.Project
What is your implicit superclass? ?? EcoSystem.Project

Each question is implemented in a different layer of the system. Things get a little complicated when asking a type for all its super types, which requires to collect the answers from both the JDT hierarchy layer and the OT hierarchy. Yet, the most tricky part was giving an implementation for getSuperclass().

An "Impossible" Requirement

There is a hidden assumption behind method getSuperclass() which is pervasive in large parts of the implementation, especially most refactorings:

When searching all methods that a type inherits from other types, looping over getSuperclass() until you reach Object will bring you to all the classes you need to consider, like so:

IType currentType = /* some init */;
while (currentType != null) {
   findMethods(currentType, /*some more arguments*/);
   currentType = hierarchy.getSuperclass(currentType);
}

There are lots and lots of places implemented using this pattern. But, how do you do that if a class has multiple superclasses?? I cannot change all the existing code to use recursive functions rather than this single loop!

Looking at Eclipse.IDEProject we have two direct superclasses: Eclipse.Project (normal inheritance, “extends”) and EcoSystem.IDEProject (OT/J implicit inheritance), which cannot both be answered by a single call to getSuperclass(). The programming language theory behind OT/J, however, has a simple answer: linearization. Thus, the superclasses of Eclipse.IDEProject are:

  • Eclipse.IDEProject → EcoSystem.IDEProject → Eclipse.Project → EcoSystem.Project

… in this order. And this is how this shall be rendered in the hierarchy view:

The final callenge: what should this query answer:

        getSuperclass(ecoSystemIDEProject);

According to the above linearization we should answer: Eclipse.Project, but only if we are in the context of the superclass chain of Eclipse.IDEProject. Talking directly to EcoSystem.IDEProject we should get EcoSystem.Project! In other words: the function needs to be smarter than what it can derive from its arguments.

Layer Instances for each Situation

Let’s go back to the layer thing:

At the bottom you see the Java model (as rendered by the package explorer). In the top layer you see the OT/J type hierarchy (lets forget about the middle layer for now). Two essential concepts can be illustrated by this picture:

  • Each layer is populated with objects and while each layer owns its objects, those objects connected with a red line between layers are almost the same, they represent the same concept.
  • The top layer can be instantiated multiple times: for each focus type you create a new OT/J hierarchy instance, populated with a fresh set of objects.

It is the second bullet that resolves the “impossible” requirement: the objects within each layer instance are wired differently, implementing different traversals. Depending on the focus type, each layer may answer the getSuperclass(type) question differently, even for the same argument.

The first bullet answers how these layers are integrated into a system: Conceptually we are speaking about the same Java model elements (IType), but we superimpose different graph structure depending on our current context.

All layers basically talk about the same objects,
but in each layer these objects are connected in a specific way as suites for the task at hand.

Inside the hierarchy layer, we actually do not handle IType instances directly, but we have roles that represent one given IType each. Those roles contain all the inheritance links needed for answering the various questions about inheritance relations (direct/indirect, explicit/implicit, super/sub).

A cool thing about Object Teams is, that having different sets of objects in different layers (Team teams) doesn’t make the program more complex, because I can pass an object from one layer into methods of another layer and the language will quite automagically translate into the object that sits at the other end of that red line in the picture above. Although each layer has its own view, they “know” that they are basically talking about the same stuff (sounds like real life, doesn’t it?).

Summing up

OK, I haven’t shown any code of the new hierarchy implementation (yet), but here’s a sketch of before-vs.-after:

Code Size
The new implementation of the hierarchy engine has about half the size of the previous implementation (because it need not repeat anything that’s already implemented in the Java hierarchy).
Integration
The previous implementation had to be individually integrated into each client module that normally uses Java hierarchies and then should use an OT hierarchy instead. After the re-implementation, the OT hierarchy is transparently integrated such that no clients need to be adapted (accounting for even more code that could be discarded).
Linearization
Using the new implementation, getSuperclass() answers the correct, context sensitive linearization, as shown in the screenshot above, which the old implementation failed to solve.
Region based hierarchies
The old implementation was incompatible with building a hierarchy for a region. For the new implementation it doesn’t matter whether it’s built for a single focus type or for a region, so, many clients now work better without any additional efforts.

The previous implementation only scratched at the surface – literally worked around the actual issue (which is: the Java type hierarchy is not aware of OT/J implicit inheritance). The new solution solves the issue right at its core: the new team OTTypeHierarchies assists the original type hierarchy (such that its answers indeed respect OT/J’s implicit inheritance). By performing this adaptation at the issue’s core, the solution automatically radiates to all clients. So I expect that investing a few days in re-writing the implementation will pay off in no time. Especially, improving the (already strong) refactoring support for OT/J is now much, much easier.

Lessons learned: when your understanding of a problem improves, you’ll be able to discard your old workarounds and move the solution closer to the core. This reduces code size, makes the solution more consistent, enables you to solve issues you previously weren’t able to solve, and transparently provides the solution to a wider range of client modules.
Moving your solution into the core could easily result in a design were a few bloated and tangled core modules do all the work, mocking the very idea of modularity. This can be avoided by a technology that is based on some concept of perspectives and self-contained layers, as supported by teams in OT/J.

Need I say, how much fun this re-write was? :)

Hiroki Kondo (kompiro)
Hiroki Kondo (kompiro)

Run customized process to notify JUnit results

I made a plugin to run customized process to notify JUnit results. Before I introduced to notify JUnit results to Grows Eclipse Plugin beforeThen Ketan's comment, "+1 for a custom command line preference this would be useful to people on other operating system". I agreed with him.So I made a plugin.If you'd like to install the plugin, could you please download jar file and copy to your dropins folder in your Eclipse.Default setting is to run growlnotify.If you want to customize that process, please open preference page and choose "Java->JUnit->Process Notification" like below.


If I use this plugin on Ubuntu linux 10.4, this plugin integrated with NotifyOSD.
The process setting is like below.

/usr/bin/notify-send -i /home/kompiro/>eclipse/icon.xpm ${summary} ${detail}

If I use this plugin on Windows, this plugin integrated with Snarl and Snarl_CMD.
The process setting is like below.
C:\Snarl_CMD_1.0\Snarl_CMD.exe snShowMessage 2 "${summary}" "${detail}

I think this plugin is not only use for notification. If you'd like to store testing log, you can use shell, script, batch, and so on.
Enjoy your testing!

Karsten Thoms
Karsten Thoms

Building Xtext projects with Maven Tycho

Last year I showed how Xtext 0.7.2 projects can be build with Maven. It requires the installation of all related plugins as Maven artifacts in a Maven2 repository, which is a rather hard and error prone task. I was asked many times since then whether I would install Xtext 1.0 artifacts or even milestone versions into the openArchitectureWare Maven2 repository. Although I can really understand this requirement my hope was that I could avoid this and show a way to enable the build with Maven Tycho. Now the time has come that Tycho is mature enough and finally I had the time to do the necessary extension for the Fornax Maven Workflow Plugin to support the recently added MWE2 workflow engine, which is used from Xtext now as default. Maven Tycho and the Fornax plugin will allow to build Xtext projects in the most natural way possible.

A basic requirement for software builds is that everything can be build just from the sources. Also it is a good practice that no generated sources are checked in into a source repository. Unfortunately this often does not hold for Xtext projects, since it is a quite hard task to execute the Xtext generator in a build process. Yes, it is possible, but until now users often have to solve it again and again. Search the net, most projects seen there will just check in all the sources. The Fornax plugin and Maven will standardize this behavior.

What do you need to enable Xtext DSL builds with Tycho? Not much. Basically a Maven 3 installation (the beta is enough) and access to the internet to access the public repositories. A better idea is to use a repository manager in the intranet (like Nexus) to act as proxy for the public repositories. You will have to add some POMs to your projects. That’s it.

I’ll show now how to enable the basic project that you get from the Xtext project wizard get build with Maven Tycho.

1. Install Maven 3

Download Maven 3 from Apache, unpack it and put the bin folder on your path. Check the installation by typing ‘mvn –version‘ in a shell. You should something like this:

mvn --version
Apache Maven 3.0-beta-1 (r935667; 2010-04-19 19:00:39+0200)
Java version: 1.6.0_20
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: de_DE, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.8" arch: "x86_64" Family: "mac"

2. Create the Xtext project

Select in Eclipse File / New / Project / Xtext Project and leave all the defaults. The project name should be org.xtext.example.mydsl for this tutorial. The projects will be created and almost empty for now. The aim is to get everything build by just adding the POMs.

3. Adjust plugin manifests

With the default Manifests the build does not execute successfully. The build fails because it has problems to resolve the logging infrastructure. It is sufficient to add Import-Package entries to resolve SLF4J and Logback. Open the plugin Manifest of the org.xtext.example.mydsl project, go to the Dependencies page and add the following Imported Packages:

  • ch.qos.logback.classic
  • ch.qos.logback.core.joran.spi
  • org.slf4j

Open the Manifest of org.xtext.example.mydsl.generator, add the same packages and additionally

  • org.apache.commons.logging

4. Add POM files

Each project will get a POM file. A Parent POM will contain the common settings and will act as a reactor POM also. Normally the Parent POM is placed in the directory above the modules, or here the plugin projects. This would be the workspace root. In this example we will place the Parent POM in the DSL grammar project. To make builds easier this POM will have the default name pom.xml. On the other side we have to add also a POM for the grammar project itself. Since it will be in the same directory we have to find another name, and we will call it pom-grammar.xml. For the other projects (.generator and .ui) we will stay with pom.xml.

4.1 org.xtext.example.mydsl/pom.xml

The Parent POM configures the Tycho plugins and aggregates the grammar project, UI project and the generator. Also the required repositories are configured here. Note that the folder “src” is added as resource path, this will add this folder to the classpath. The workflow execution would fail if the workflow module cannot be found on the classpath.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>p2.osgi.bundle</groupId>
	<artifactId>org.xtext.example.mydsl.parent</artifactId>
	<version>1.0.0</version>
	<packaging>pom</packaging>
	<name>org.xtext.example.mydsl.MyDsl - Parent</name>

	<properties>
		<version.tycho>0.9.0</version.tycho>
	</properties>

	<modules>
		<module>./pom-grammar.xml</module>
		<module>../org.xtext.example.mydsl.ui</module>
		<module>../org.xtext.example.mydsl.generator</module>
	</modules>
	<build>
		<!-- The src directory must be named as resource dir to put it on the build classpath. This is required to resolve the
			workflow module named in the .mwe2 file -->
		<resources>
			<resource><directory>src</directory></resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.sonatype.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${version.tycho}</version>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<groupId>org.sonatype.tycho</groupId>
				<artifactId>target-platform-configuration</artifactId>
				<version>${version.tycho}</version>
				<configuration>
					<resolver>p2</resolver>
				</configuration>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.fornax.toolsupport</groupId>
					<artifactId>fornax-oaw-m2-plugin</artifactId>
					<version>3.1.0-SNAPSHOT</version>
					<configuration>
						<workflowEngine>mwe2</workflowEngine>
					</configuration>
					<executions>
						<execution>
							<phase>generate-sources</phase>
							<goals>
								<goal>run-workflow</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	<repositories>
		<repository>
			<id>p2.eclipse.helios</id>
			<url>http://download.eclipse.org/releases/helios</url>
			<layout>p2</layout>
		</repository>
	</repositories>
	<pluginRepositories>
		<!-- At the moment the Fornax plugin is only available as snapshot -->
		<pluginRepository>
			<id>fornax-snapshots</id>
			<url>http://www.fornax-platform.org/archiva/repository/snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>
</project>

org.xtext.example.mydsl/pom-grammar.xml

The build of the grammar project needs to execute the workflow src/org/xtext/example/mydsl/GenerateMyDsl.mwe2. All other settings are already managed by the parent.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>p2.osgi.bundle</groupId>
		<artifactId>org.xtext.example.mydsl.parent</artifactId>
		<version>1.0.0</version>
		<relativePath>../org.xtext.example.mydsl/pom.xml</relativePath>
	</parent>
	<artifactId>org.xtext.example.mydsl</artifactId>
	<packaging>eclipse-plugin</packaging>
	<name>org.xtext.example.mydsl.MyDsl - Grammar</name>

	<build>
		<plugins>
			<plugin>
				<groupId>org.fornax.toolsupport</groupId>
				<artifactId>fornax-oaw-m2-plugin</artifactId>
				<configuration>
					<workflowDescriptor>src/org/xtext/example/mydsl/GenerateMyDsl.mwe2</workflowDescriptor>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

org.xtext.example.mydsl.ui/pom.xml

The build configuration of the UI plugin is even easier. Only the reference to the parent and the minimum project coordinates need to be configured.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>p2.osgi.bundle</groupId>
		<artifactId>org.xtext.example.mydsl.parent</artifactId>
		<version>1.0.0</version>
		<relativePath>../org.xtext.example.mydsl/pom.xml</relativePath>
	</parent>
	<artifactId>org.xtext.example.mydsl.ui</artifactId>
	<packaging>eclipse-plugin</packaging>
	<name>org.xtext.example.mydsl.MyDsl - UI</name>
</project>

org.xtext.example.mydsl.generator/pom.xml

The generator plugin must execute its workflow. Note that the src directory and the compile directory of the grammar project are set as resource directory.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>p2.osgi.bundle</groupId>
		<artifactId>org.xtext.example.mydsl.parent</artifactId>
		<version>1.0.0</version>
		<relativePath>../org.xtext.example.mydsl/pom.xml</relativePath>
	</parent>
	<artifactId>org.xtext.example.mydsl.generator</artifactId>
	<packaging>eclipse-plugin</packaging>
	<name>org.xtext.example.mydsl.MyDsl - Generator</name>

	<build>
		<resources>
			<resource><directory>src</directory></resource>
			<!-- Add the grammar classes to the classpath -->
			<resource><directory>../org.xtext.example.mydsl/target/classes</directory></resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.fornax.toolsupport</groupId>
				<artifactId>fornax-oaw-m2-plugin</artifactId>
				<configuration>
					<workflowEngine>mwe2</workflowEngine>
					<workflowDescriptor>src/workflow/MyDslGenerator.mwe2</workflowDescriptor>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

5. Execute the build

Now the build should be executable. Run ‘mvn clean install‘ in the root of the org.xtext.example.mydsl project. Here is an excerpt of the console log you should get. The complete log can be viewed here.

mvn install
[INFO] Scanning for projects...
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[INFO] Resolving target platform for project MavenProject: p2.osgi.bundle:org.xtext.example.mydsl:1.0.0 @ /Users/thoms/temp/tycho/trunk/trunk/org.xtext.example.mydsl/pom-grammar.xml
log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient).
log4j:WARN Please initialize the log4j system properly.
[INFO] Adding repository http://download.eclipse.org/releases/helios
[INFO] Adding repository http://download.eclipse.org/releases/helios
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[INFO] Resolving target platform for project MavenProject: p2.osgi.bundle:org.xtext.example.mydsl.ui:1.0.0 @ /Users/thoms/temp/tycho/trunk/trunk/org.xtext.example.mydsl.ui/pom.xml
[INFO] Adding repository (cached) http://download.eclipse.org/releases/helios
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[INFO] Resolving target platform for project MavenProject: p2.osgi.bundle:org.xtext.example.mydsl.generator:1.0.0 @ /Users/thoms/temp/tycho/trunk/trunk/org.xtext.example.mydsl.generator/pom.xml
[INFO] Adding repository (cached) http://download.eclipse.org/releases/helios
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] org.xtext.example.mydsl.MyDsl - Parent
[INFO] org.xtext.example.mydsl.MyDsl - Grammar
[INFO] org.xtext.example.mydsl.MyDsl - UI
[INFO] org.xtext.example.mydsl.MyDsl - Generator
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building org.xtext.example.mydsl.MyDsl - Parent 1.0.0
[INFO] ------------------------------------------------------------------------
....
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] org.xtext.example.mydsl.MyDsl - Parent ............ SUCCESS [0.681s]
[INFO] org.xtext.example.mydsl.MyDsl - Grammar ........... SUCCESS [26.418s]
[INFO] org.xtext.example.mydsl.MyDsl - UI ................ SUCCESS [3.103s]
[INFO] org.xtext.example.mydsl.MyDsl - Generator ......... SUCCESS [10.844s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

5. Miscalleneous

5.1 ANTLR 3 download

Xtext relies on ANTLR 3, which cannot be hosted at Eclipse.org due to incompatible licenses. Therefore Xtext has introduced an automatic download (FYI: This behavior is implemented in AntlrToolFacade) that you have to confirm once:

*ATTENTION*
It is recommended to use the ANTLR 3 parser generator (BSD licence - http://www.antlr.org/license.html).
Do you agree to download it (size 1MB) from 'http://download.itemis.com/antlr-generator-3.0.1.jar'? (type 'y' or 'n' and hit enter)

Now an automatic build is not so responsive to questions like these. The plugin will confirm this download automatically.

5.2 Workflow execution problems

If the Maven plugin does not execute the MWE2 workflow properly it is not so responsive at the moment to name the root cause. But when running the Maven command with “-X” it will output the full Java command including classpath to the console. Copy the full command and try to execute it from the same directory. This might help to detect the problem you have.

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -classpath /Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.xpand/1.0.0.v201006150611/org.eclipse.xpand-1.0.0.v201006150611.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.xtend/1.0.0.v201006150611/org.eclipse.xtend-1.0.0.v201006150611.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.mwe.core/1.0.0.v201006150535/org.eclipse.emf.mwe.core-1.0.0.v201006150535.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.ecore/2.6.0.v20100614-1136/org.eclipse.emf.ecore-2.6.0.v20100614-1136.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.common/2.6.0.v20100614-1136/org.eclipse.emf.common-2.6.0.v20100614-1136.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.apache.commons.cli/1.0.0.v20080604-1500/org.apache.commons.cli-1.0.0.v20080604-1500.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.mwe2.runtime/1.0.0.v201006150446/org.eclipse.emf.mwe2.runtime-1.0.0.v201006150446.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/com.ibm.icu/4.2.1.v20100412/com.ibm.icu-4.2.1.v20100412.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.xtext/1.0.0.v201006170321/org.eclipse.xtext-1.0.0.v201006170321.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.ecore.xmi/2.5.0.v20100521-1846/org.eclipse.emf.ecore.xmi-2.5.0.v20100521-1846.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.util/1.0.0.v201006170321/org.eclipse.xtext.util-1.0.0.v201006170321.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/com.google.collect/0.8.0.v201006170321/com.google.collect-0.8.0.v201006170321.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/com.google.inject/2.0.0.v201003051000/com.google.inject-2.0.0.v201003051000.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.antlr.runtime/3.0.0.v200803061811/org.antlr.runtime-3.0.0.v200803061811.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.mwe.utils/1.0.0.v201006150535/org.eclipse.emf.mwe.utils-1.0.0.v201006150535.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.mwe2.launch/1.0.0.v201006150907/org.eclipse.emf.mwe2.launch-1.0.0.v201006150907.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.emf.mwe2.language/1.0.0.v201006150907/org.eclipse.emf.mwe2.language-1.0.0.v201006150907.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.xtext.common.types/1.0.0.v201006170321/org.eclipse.xtext.common.types-1.0.0.v201006170321.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.eclipse.xtend.typesystem.emf/1.0.0.v201006150611/org.eclipse.xtend.typesystem.emf-1.0.0.v201006150611.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/ch.qos.logback.classic/0.9.19.v20100519-1505/ch.qos.logback.classic-0.9.19.v20100519-1505.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/ch.qos.logback.core/0.9.19.v20100419-1216/ch.qos.logback.core-0.9.19.v20100419-1216.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.apache.commons.logging/1.1.1.v201005080502/org.apache.commons.logging-1.1.1.v201005080502.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.slf4j.api/1.5.11.v20100519-1910/org.slf4j.api-1.5.11.v20100519-1910.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/ch.qos.logback.slf4j/0.9.19.v20100519-1910/ch.qos.logback.slf4j-0.9.19.v20100519-1910.jar:/Users/thoms/.m2/repository/p2/osgi/bundle/org.slf4j.log4j/1.5.11.v20100419-1106/org.slf4j.log4j-1.5.11.v20100419-1106.jar org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher /Users/thoms/Development/workspaces/oaw-v5-test/org.xtext.example.mydsl.generator/src/workflow/MyDslGenerator.mwe2

5.3 Fornax Plugin Snapshot version

The Maven plugin org.fornax.toolsupport:fornax-oaw-m2-plugin is not released yet. Yesterday I have added the necessary support for MWE2 and deployed a snapshot version 3.1.0-SNAPSHOT. Some minor issues have to be solved before it will be released.

5.4 Missing log output

The plugin forks a JVM with help of the Java ant task type. At the moment the output from the forked JVM does not get redirected to the Plugin’s log. This is one issue to solve for the Plugin before release. It makes debugging problems a bit harder, but when copying the executed Java command that you get from the debug output and execute yourself you get a better impression of the error.

5.5 Download sources

For your convenience you can download the example project here.


Paul Trevithick
Paul Trevithick

XDI, Semantic Web and Higgins

I thought I’d start with the diagram above and add the explanatory text later. But for now, as I hope you can see, I’ve been trying to create a visual summary of these three tech stacks and how they implement different necessary capabilities for user-centric personal information sharing. More later…

Bob Brodt
Bob Brodt

LaMiPU (Part 1)

Give me a lever and a place to stand and…oh yeah, maybe some duct-tape

When I first saw Intalio’s very excellent case study for Finnair I thought “wow, what a cool idea!” And what a perfect application of SOA technology to solve a very real problem that is forcing a lot of airlines to come up with creative ways of cutting costs.

Being a huge fan of MacGyverism, I then thought about how this application could be improved and how I would implement the solution with just a paper clip, a rubber band and some duct tape - on a much smaller scale, of course. The end result should be nothing short of mildly impressive, considering that this project should cost about $20 in hardware (not counting the cost of an old clunker of a PC which had already been end-of-lifed) and $0 in open-source software. This project, affectionately know as “LaMiPU” (Last Minute Passenger Upgrade) will be the topic of my next several blog entries.

Backgrounder

If you’ve had to fly cross country on a commercial airline lately, you’ve probably noticed that the airplanes are invariably packed to capacity. That’s because in order to remain profitable, airlines must fill all available seats, usually selling the same seat (slightly) more than once at a ratio as high as 1.5 to 1. The seats that sell out less quickly and are sometimes left empty are, obviously, the more expensive business class and really more expensive first class seats because, let’s face it, how many of us regular folk can afford to plunk down $3K for a cross-country flight just for the luxury of a little bit of leg room and a comfy chair. Besides, if an airline overbooks the economy seating section and has to “bump” a couple of passengers to a later flight, there are usually plenty of volunteers willing to make the sacrifice and grudgingly accept a free flight voucher and a free stay at the airport’s red carpet room in exchange for arriving at their destination a few hours (or days) later. If they try to pull that stunt on some muckety-muck, the poor customer service personnel will probably have their ears chewed off.

Pulling ideas out of Finnair

So, as an airline company, how do you avoid flying your airplanes with lots and lots of those really expensive, money making, first class comfy chairs empty and unpaid for? Easy: offer them as “upgrades” (for a “small” fee) to your loyal customers enrolled in your frequent flyer programs; after all, making a little profit on those empty seats is better than making no profit. And besides, this frees up more of your economy seats for potential overbooking. It’s a win-win!

The problem with this scheme however, is that you have to be able to pull this off in a very short period of time. First class no-shows will sometimes cancel their trip last minute (and get a partial, if not full refund for their ticket) leaving the airline holding the proverbial bag. The trick is to offer those seats to your loyal customers who you know will be on the flight because they have already checked in at the ticket counter. This leaves you with a time window of maybe 10-30 minutes to:

  1. discover the fact that one or more of your first class seats are empty

  2. figure out who has already checked in, and which of those people are enrolled in your frequent flyer program

  3. contact those people one-by-one in order based on seniority in the program and offer them the seat upgrade

  4. wait for each of those people to make up their minds to either accept or refuse the upgrade; if they refuse, move on to the next loyal customer in the list; if they accept then…

  5. pull their credit card information on file, and have them verify it while you still have their attention

  6. wait for the loyal customer to fumble around in his/her wallet for the credit card

  7. make the credit card authorization; if accepted send the loyal customer verification and somehow make available a new boarding pass in the form of printed or electronic media; if the credit authorization is denied, then go back to #3, lather, rinse and repeat.

Because this process is serial (each customer has to be contacted sequentially because you may only have one first-class seat to offer) it’s doubtful that this strategy would succeed if it were all being done manually. And that is what makes the Intalio solution so elegant.

Oh by the way…if I sound a little bitter, it’s not that I’m begrudging the airlines their profits, it’s just that I’ve been the victim of overbooking and have many times found myself the witless volunteer, accepting a later flight and a voucher (which, by the way, I still haven’t had a chance to cash in on yet :( )

So now that you have a reasonably good understanding of the nature and complexity of the problem, the next step is to figure out what data resources are already available to be taken advantage of, and which pieces need to be filled in to build a working solution. And that, dear reader, is the topic of my next blog. Stay tuned…

Kaloyan Raev
Kaloyan Raev

JPA Diagram Editor first milestone released

I am happy to announce that the JPA Diagram Editor project made its first milestone release - 0.5 RC1. Just follow the installation instructions, posted on the project’s wiki, and you are ready to build your JPA model in a diagram. There is a nice Getting Started tutorial to help your first steps. If you want to take a quick look before installing, then check our demo on YouTube.

An example of a diagram created by the JPA editor

The JPA Diagram Editor is a new incubating project in the WTP Incubator. The project is initiated by SAP and aims to contribute the existing JPA Diagram Editor from the SAP NetWeaver Developer Studio, and continue its future development in the Eclipse community. This contribution is based on the Graphiti project - the new graphics modeling infrastructure in Eclipse.

The official 0.5 version of the project will provide a stable release of the initial contribution. Due to the migration to Graphiti, there are some bugs to be cleaned and we are actively working on them. Nevertheless, we decided to release early to hear your feedback sooner. If you eventually find a bug, then please report it in the WTP Incubator Bugzilla (use component wtp.inc.jpaeditor). You can check the list of already reported bugs if that bug has already been found - we are actively testing at the moment.

Please, note that currently the JPA Diagram Editor supports only JPA 1.0 projects. This mean that you will not see the “Open Diagram” action in the context menu of JPA 2.0 projects. JPA 2.0 support is definitely on our radar screen. We will start working on it after releasing the stable 0.5 version.

Any feedback is very welcome. Especially with suggestions how to evolve the project in the future months. We are available on the WTP Incubator Forum and wtp-incubator-dev@eclipse.org mailing list.

Dave Carver
Dave Carver

Tip: Enabling JUnit Short Cuts

If you are trying to practice Test Driven Development, creating JUnit tests in eclipse can be a real chore at times. I'm not talking about actually writing the tests, but trying to get easy access to the JUnit wizards. The short cuts for creating these types of classes is missing by default from the File->New shortcuts menu when working in the Java Perspective and the Plugin-Development perspective. To enable these shortcuts, you must customize the perspective and go to the Shortcuts tab in eclipse:




By checking the JUnit option under Java, you will now get the JUnit and JUnit Test Suite options added to the File->New menu. Thus saving several tedious clicks through the File->New->Other->Java->Junit wizard.

Hiroki Kondo (kompiro)
Hiroki Kondo (kompiro)

Where is DS Annotation?

I used Declarative Service in my application, JAM Circle.
Declarative Service is cool stuff.
It makes to solve bundles startup order.
But I confused a thing.
How do I inject the service at startup time?
I think services needs to initialize at startup.
So I choosed the way to solve by singleton class like below.

scr.xml
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.kompiro.jamcircle.kanban.ui.KanbanUIContext">
<implementation class="org.kompiro.jamcircle.kanban.ui.KanbanUIContext"/>
<reference bind="setKanbanService" cardinality="1..1" interface="org.kompiro.jamcircle.kanban.service.KanbanService" name="KanbanService" policy="static"/>
<reference bind="setScriptingService" cardinality="1..1" interface="org.kompiro.jamcircle.scripting.ScriptingService" name="ScriptingService" policy="static"/>
</scr:component>

and implementation of Context class(The name inspired from "ApplicationContext")


package org.kompiro.jamcircle.kanban.ui;

import org.kompiro.jamcircle.kanban.service.KanbanService;
import org.kompiro.jamcircle.scripting.ScriptingService;

public class KanbanUIContext {

private static KanbanUIContext context;
private KanbanService kanbanService;
private ScriptingService scriptingService;

public KanbanUIContext() {
KanbanUIContext.context = this;
}

public static KanbanUIContext getDefault(){
return context;
}

public KanbanService getKanbanService() {
return kanbanService;
}

public void setKanbanService(KanbanService kanbanService) {
this.kanbanService = kanbanService;
}

public ScriptingService getScriptingService() {
return scriptingService;
}

public void setScriptingService(ScriptingService scriptService) {
this.scriptingService = scriptService;
}

}


It's not good way(T_T)... KanbanUIContext is a singleton class and be used to call ServiceLocator Pattern. It is not easy to test by code...
I haven't know there is no way to inject to use annotation for field injection.
Is there any way to use annotation and field injection?

Hiroki Kondo (kompiro)
Hiroki Kondo (kompiro)

JAM Circle 0.8.0 released

Hi all!

I'm glad to announce to release my RCP application JAM Circle 0.8.0!
Download site
https://sourceforge.net/projects/jamcircle/files/

Project Page
http://kompiro.org/jamcircle

These are New Feature.
* Migrated p2 base Eclipse platform
* Added some Board customize extension point
* JRuby Scripting Console
* improved figures design
* added Japanese resource
* added Eclipes Plug-in Edition
* fixed some bugs

Tom Schindl
Tom Schindl

ESE 2010, e4 and my submissions

The submission deadline for ESE 2010 is over and there are many many submission. Let me first of all talk about my submissions:

  • Adopt the e4 progamming model in Eclipse >= 3.6
    This talk discusses how you can make single sourcing for Eclipse 4.0 and Eclipse 3.6 happen without the use of backwards compat layer coming with Eclipse 4.0
  • Can developers adopt e4-RCP for Swing Applications?
    This talk discusses how Eclipse Application Platform 4.0 can be used with other UI-Technologies (e.g. Swing)
  • The way to Eclipse 4.0 and 4.1
    In this talk Boris Bokowski and myself will you provide a summary of the last 2 years of on going development of Eclipse 4. Things we achieved, things we failed, things we work on for Eclipse 4.1.
  • Eclipse 4.0 Hackfest
    If you want to discuss Eclipse 4 with others and some of the committers on the project. I think this is the right thing for you.

Beside that I’m really amazed by the number of talks who are filed under the Eclipse 4.0 category. What I like most is that the submission are not only from Eclipse 4.0 committers (of course many of them are) but also from early adopters (like The thrill of migrating a mission-critical RCP-application to E4: lessons learned from Jürgen Baier) and framework developers like Christian Campo – Riena on e4 aka “RCP 2.0″ and Matthias Zimmermann & Andreas Hoegger – Eclipse Scout “Querbeet”, tooling provides like Stephane Begaudeau & Jonathan Musset – Acceleo Code Generator, an experimental transition to e4 to people who apply Eclipse 4.0 technologies in none UI-Environments like Gunnar Wagenknecht – Hot e4 stuff for building cool server applications


August 17, 2010

Eclipse Announcements
Eclipse Announcements

Attend Eclipse Government Day or Eclipse Enterprise Days

Along with sponsors including Actuate, BandXI, EclipseSource, Oracle and Open Source for America, the Eclipse Foundation is pleased to announce both the Eclipse Government Day and Eclipse Enterprise Days.

Donald Smith
Donald Smith

Eclipse Government Day and Eclipse Enterprise Days

We're organizing two events this fall in Reston, VA. Reston has the convenience of being a mere 15 minutes from Dulles (IAD) airport.

The first event is Eclipse in Government Day. This event is for individuals working for, or contracting with, Government agencies and departments. This is where I could use your help -- if you happen to have any friends or colleagues that are using Eclipse in Government, please do forward a link to the event wiki page or to this blog. This event takes place on Tuesday, October 12th.

The second event is Eclipse in the Enterprise Days. This is a 2 day event (ending 3pm on second day to give people a chance to catch dinner time flights out) and is focused on IT, Architect and Development manager individuals who are responsible for Eclipse in Organizations with hundreds, or even thousands of developers. The agenda on this event is still quite fluid and I have a few folks representing the enterprise helping me shape out the content -- if you have content suggestions, and/or are able to speak yourself, please do let us know! Details are on the events page. This event is Wednesday/Thursday October 13th, 14th.

- Don

Jesper Møller
Jesper Møller

Stuff you learn about when it breaks

Somewhere in my basement I have a copy of Winograd and Flores' Understanding Computers and Cognition, required reading in some late-1990'es HCI course. Just about the only thing I remember from that book is this quote: "The word processor exists as a collection of hardware or programs only when it breaks down." This is in the sense that you don't think about a tool which doesn't get in the way, and only when it fails (or is missing), you notice it and start to analyse it.

Fast forward some 13 years, a few days ago, I finally got around to writing some better UI tests of WTP's "XPath View", using SWTBot as the weapon of choice. Having read the SWTBot getting started docs and some useful blog posts, writing my tests were soon well underway, using the fluent API provided. It is fun to watch the application speeding along like time-lapse film, like magic.
Everything went fine until I wrote code to switch the XPath view's active process from XPath1.0 to XPath2.0, using the view's menu. The API was pretty easy to figure out, but the view menu finder just didn't pick up the menu item I wanted.

There's my breakdown: Why?
Well, it turns out that unlike regular menus and context menus, view menus are collected in a different fashion by SWTBot, by examining the contributions rather than enumerating the SWT objects themselves. Some corners cases are not covered. Not a big deal, really, but it made me look at the source for SWTBot, which is quite a pleasant sight. Now it exists as real code in my mind, as does the Eclipse command framework implementation. And I also now "get" the Hamcrest Matcher framework which I've previously thought to be horribly over-engineered.
With my new knowledge, I can even extend SWTBot. Nice.

Then fast forward two more days, while this blog post was sitting half-finished in my browser, Saturday evening, after historic amounts of rain in the area, my basement was flooded: The sewer couldn't contain the rain, and the system broke down and came very much into existence, as sewage water gushed up from the drains and toilet and my otherwise dry basement became a 20cm deep paddling pool, allover. Getting the water out took hours; getting the smell out will take days, maybe weeks.

Like software, sewage is something most people would rather not have to deal with. It's supposed to be "invisible magic", but in reality it is messy and complicated, and when it doesn't work, it makes for a shitty situation -- yet our society very much depends on it.
The really strange part is the book: I haven't found it yet, not in the "dry" pile, the "slightly damp but fine" pile, the "soggy yet perhaps readable" pile, or the "discard" pile. I know that book must be down there somewhere, and when I find it, it's going back into my reading queue right away.

P.S: My flooded basement was a picnic compared to the flood in Pakistan. Consider donating to your favorite charity!

Eric Rizzo
Eric Rizzo

Setting up .java files to automatically open with Eclipse on Mac OS X

With the 3.6 (aka, Helios) release of Eclipse, there is now support for opening files from the operating system command line or file browser directly into Eclipse. This has been a long-standing feature request (one of the oldest requests to ever have been implemented, in fact) and many people are happy to have it. Here is a quick tutorial on utilizing this feature under Mac OS X to associate .java files so that they open in Eclipse upon double-click from Finder. Although this demonstrates using .java files, you can do the same for any other file type; as long as your installation of Eclipse has an editor to handle that file type, it should work just fine.

  1. Just to re-iterate, you have to have Eclipse Helios (version 3.6 of the platform) in order to take advantage of this feature. If you don't already have it, go get it.
  2. In Finder, locate a .java file that you'd like to open in Eclipse; right-click (or Control+click if that's the way you roll) and select Get Info



  3. In the Info dialog, under the "Open with:" section, click the drop-down list and select Other...



  4. Here comes the only tricky part about this process.
    In the resulting Finder dialog to select an application, navigate to where Eclipse is installed. You'll see Eclipse.app listed but chances are, it's disabled; you can't select it. You just have to enable it using the Enable: drop-down list at the bottom of the window, as shown here:

    Once you do that, you'll be able to select Eclipse.app.

  5. Before clicking the Add button, decide if you want to select the "Always Open With" option (checkbox). Then click Add.
  6. Back in the "Info" dialog, you can use the Change All... button to associate all .java files with Eclipse. Even if you don't do it now, you an always come back to this dialog and do it later.
That's it. Now when you double-click on .java files they will be opened in the Eclipse installation that you selected. If an instance of Eclipse is already running, that instance will open the file. Otherwise, a new instance will be started.

Kai Toedter
Kai Toedter

CSS Theming for Eclipse RCP 3.x

Eclipse 4.0 brought a great new feature: Theming RCP applications with CSS. Another good news is, this cool feature can also be used with RCP 3.x based applications. The following screen shot shows the RCP Mail Demo, styled with CSS:

How to run the Demo with CSS styling?

  1. Checkout :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse/e4/releng
  2. Import Project Set /releng/org.eclipse.e4.ui.releng/e4.ui.css.psf
  3. Checkout e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.widgets (see bug 322641)
  4. Cleanup org.eclipse.e4.ui.css.swt (see bug 322644)
    => Organize Imports
    => Delete dependencies to org.eclipse.e4.core.*
  5. Start the CSS RCP Mail demo (project org.eclipse.e4.ui.examples.css.rcp)

The demo also provides dynamic theme switching. Here is is little excerpt from the defaul.css styling:

CTabItem, Label, Tree, Text {
 font-family: "Arial";
}

Shell {
 font-size: 12;
}

CTabItem, ToolBar, Button, CBanner, CoolBar {
 font-size: 9;
 background-color: white;
}

CTabFolder, CTabItem {
 background-color: #F0F1F7;
}

If you would like to play around with the css, just edit the files css/default.css and css/colorful.css in the project org.eclipse.e4.ui.examples.css.rcp. I have submitted a short talk at Eclipse Summit Europe to explain a few more details.

Have Fun!

Kai
Follow me on Twitter

If you like my blog, please feel free to flattr it flattr this!