Eclipse hints, tips, and random musings

Wayne Beaton’s blog about Eclipse.

Event Service

July 17th, 2008 by Wayne Beaton

I blogged a while back about the potential use of a bus for delivering property change notifications in place of the very common observer pattern. A reader commented that the exact service I need to implement that sort of thing is already available in the form of the OSGi Event Service. An implementation of this service is provided by the Equinox project.

I’ve updated part of the Eclipse Expense Expense Reporting Tool example to make use of the service.

I updated my business domain objects to post events detailing their changes through the EventAdmin service. This was made relatively easy owing to the fact that I had already implemented those objects with a common superclass. I added the postEvent(…) method to that common superclass:

	void postEvent(String propertyName, Object oldValue, Object newValue) {
		EventAdmin eventAdmin = getEventAdmin();
		if (eventAdmin == null) return;

		Properties properties = new Properties();
		properties.put(SOURCE, this);
		properties.put(SOURCE_TYPE, this.getClass().getName());
		properties.put(PROPERTY_NAME, propertyName);
		if (oldValue != null) properties.put(OLD_VALUE, oldValue);
		if (newValue != null) properties.put(NEW_VALUE, newValue);

		eventAdmin.postEvent(new Event(PROPERTY_CHANGE_TOPIC, properties));
	}

It’s pretty straightforward. The first thing it tries to do is obtain the service. The getEventAdmin() method uses the bundle activator (and a ServiceTracker) to find a service that implements EventAdmin. If no such service can be found, we bail out and pretend that nothing happened. If we do find an EventAdmin, we create and post an Event instance. The postEvent method posts the event to be delivered asynchronously; the sendEvent method delivers the event to waiting handlers before returning.

The Event instance is packed with properties. The nature of these properties are application-specific. In this case, I’m including properties that tell me what has changed and in what object. The event also has a "topic". The topic is used to determine how the event is delivered; only event handlers that are listening for this particular topic will be informed of the event (there’s a little more to it than this). It’s very much like the Java Messaging Service (JMS).

This is only part of the story. Publishing events through the event service is only interesting if there are subscribers on the other side. I’ll talk about what I’ve done on that side sometime next week…

Holy Cow!

July 17th, 2008 by Wayne Beaton

Participation in the Usage Data Collector has been nothing short of outstanding. As of this moment, we have gathered usage data from more than 22,000 users (more than 20,000 new participants this month alone). The usage trends page shows this in a cool graph.

The other reports that we’ve generated are a little out of date since running those reports is pretty darned time consuming. I’ve optimized the database for storage space first, writes second, and reading/reporting third. I’m going to spend some time today making reading a little less painful so that we can actually run those reports.

22,000 users participating. Staggering.

Paste Snippet

July 7th, 2008 by Wayne Beaton

Try this in Eclipse Ganymede (one of the variants that includes the Java development tools):

Copy this text:

System.out.println(new Date());

Bring the Package Explorer into focus (make sure that none of the existing projects is highlighted) and select “Paste” from the context menu.

JDT will build the project, package, class, and main method for you. How cool is that?

There’s a lot more hidden in the new and noteworthy. I’m in love with the rich hovers.

Eclipse IDE for Education

July 7th, 2008 by Wayne Beaton

I just created bug 239808, Eclipse IDE for Education, as a proposal for a new component in the SOC project. Please add your comments on the bug. While you’re at it, we’re looking for volunteers…

The proposal originates from the need to provide a streamlined environment to help first-year undergraduate-level university students ease into the combined challenges of learning about programming, programming languages, and an integrated development environment.

Initial work has focused on providing a simplified Java development perspective with a view that makes it much easier to create packages and classes for assignments. Future work may include streamlining of other workflows, views, and editors. I think this project has a lot of cool potential. Imagine integrating some ECF code that would allow a student—with the push of a single button—to share their editor with a teaching assistant to get help remotely. Or another button that—with a click—packages up the work and submits it for marking.

As a general rule, the SOC project is intended as a place for mentored student work done under the Google Summer of Code (GSoC) programme. However, we were careful when we created the project to allow for flexibility. The spirit of the project is to provide a place for student and student-related work to occur. I believe that the Eclipse IDE for Education falls into the student-related category.

I believe that the Eclipse IDE for Education has many merits that bring value to the SOC project. In particular:

  1. It will be long-lived and thus should provide some much-needed continuity to the project
  2. We have started to attract other professors and researchers to get involved. Their involvement will raise the awareness of the SOC project
  3. Some students are bound to get involved. It seems like a natural thing for SOC 2009 student projects.

Initial committers on the new project will likely all be SOC mentors. However, I do anticipate that we will pick up several students once we get the project underway. In my fantasy scenario, the component will act as a lightening rod for student involvement.

Java Forum Stuttgart 2008

July 4th, 2008 by Wayne Beaton

There’s something about the Java Forum Stuttgart conference that I really like. The conference is a little on the large size (I believe that I heard that there were 1,200 attendees) which gives the exhibit area a really busy feel. Good busy.

As a speaker, I can’t say enough about this conference. They take care of us. Every year they get us great gifts. The best part is that the gifts tend to have some local tie-in. This year, they gave us coffee and tea from local providers. It came with a little booklet that, if I could read German, would tell me all about the company and how it is a cornerstone of the Stuttgart business community. That personal touch is nice. It also helps that they assign me my very own personal assistant (who I assume is the very own personal assistant for a couple of other folks). This year, she remembered my Modelleisenbahn hobby and had a map ready for me pointing out the locations of local stores.

My talk went very well. I presented Mylyn to a standing room only crowd (apparently there were about a dozen people in an overflow room). Here’s what they looked like from my perspective.

image002.jpg

I decided to mix things up a bit this time through and started with a demo. I went out on a bit of limb and just started implementing part of the solution for bug 237658. The first thing I did was create subtask for this bug. With Mylyn 3.0, new tasks (or subtasks) can be created for a repository without actually submitting them (which was handy as I didn’t notice the Ethernet cable which I’m sure would have given me Internet access if I had thought to try it). So I created the subtask and just started into changing the Expenses (EBERT) application to channel change events through the Equinox event framework. I plan to submit the new subtasks to Bugzilla and check the code into a new branch sometime soon (I’m feeling a little lazy right now).

I asked the audience to try not to get too taken by the Equinox stuff and focus on the task-oriented development process (I really did want to get them thinking a bit more about Equinox and the Examples project). In the process, I managed to show off the Bugzilla integration, and the Über-cool context-based filtering. I wrapped up with a quick pass through the slides to reinforce what I demonstrated. The net result of the demonstration was the same as last year: I felt like a rock star. People love Mylyn.

One of the disturbing take-homes from the session is the number of developers who apparently do not use an issue tracking system of any form. Mylyn supports, Bugzilla, JIRA, Trac, XPlanner, CodeBeamer, and more. But there were a lot of questions about how Mylyn can be used to share tasks without a repository (I showed how you can drag tasks out of the Task List view onto the file system and then from the file system into a different workspace’s Task List; I guess that works).

I rounded out my week by talking about Ganymede with two different audiences. The first audience got to listen to me two hours after I got off the plane. It was not one of my best performances. The crowd today in Zürich seemed to have had a better time; clearly a few extra hours of rest make big difference.

I leave you today with a picture I took of Doug Clarke from the EclipseLink project from last night’s Stammtisch.

image005.jpg

It’s good to be king.

But I’m not a Newbie!

July 3rd, 2008 by Wayne Beaton

If you have a question about some Eclipse project, the newsgroups are your best bet.

If you’re not sure what group is appropriate for your question, post it on newcomer. Posters to newcomer are often redirected to other newsgroups, but newcomer is a good starting point since a lot of very knowledgeable people watch the group pretty carefully.

The newcomer group may be misnamed. While it is indeed for newcomers, it’s not exclusively for them. Lots of folks who have years of experience with Eclipse post their questions there.

The newcomer newsgroup isn’t just for newbies. Can you think of a better name?

Stammtisch at the Hotel Krone in Stuttgart, July 3rd.

June 26th, 2008 by Wayne Beaton

One of the more exciting things I get to do when I visit Germany is attend one of Ralph’s many Stammtisches (or is that Stammtischae?) For the uninitiated, Stammtisch translates roughly into “regular’s table”. Ralph’s incarnation of the tradition brings members of the Eclipse community together to socialize and network while drinking beer and eating tasty Germany food.

If you’re in the Stuttgart area next week, please drop by the Hotel Krone at 1900h (the hotel is actually in Steinenbronn which is a little south and west of Stuttgart).

Project Pairing Visualization

June 24th, 2008 by Wayne Beaton

At Nick’s suggestion, I’ve been tinkering with using Zest to visualize the project pairing data that I’ve spend so darned much time gathering from the Usage Data Collector results over the past week.

This image was generated using the “Spring graphlayout algorithm to represent how closely related the various projects are.

proximity.png

The spring layout algorithm pulls the most frequently used project combinations towards each other, so those projects most commonly found in the wild naturally drift to the middle.

I’m not very happy with the way that it’s drawn; I’ll work on that over the next few days. Right now, it runs as an SWT application. I may turn it into a plug-in.

The graph helped me notice a few other bundles that needed to be rolled into their project (recall that the names shown on the report and in this graph are taken from the third segment of each bundle’s symbolic name). So, in the next version of the report (and this graph), ‘cvs’ will be rolled into ‘platform’, and ‘contribution’ into ‘ajdt’. I also decided to roll those curious ‘mylar’ references into ‘mylyn’.

Ganymede Presentation

June 23rd, 2008 by Wayne Beaton

I’m working on a presentation about Ganymede. I’ve already got some slides from the talk Mike and I did at JavaOne 2008, and am in the process of adding material from Chris’ article on developerWorks. I’ve scavenged a lot of material from the Eclipsepedia wiki on the topic and have loaded the latest and greatest from the Data Tools Project to look into that fancy new visual SQL Query Builder.

Is there anything in particular that you think I should mention? Please post your ideas or send them via email (I’m the only ‘wayne’ at eclipse.org).

I intend to make the presentation available for all to use on the Eclipse Resources page.

Project Pairing reports: Now with column sorting!

June 23rd, 2008 by Wayne Beaton

Last week, I wrote about a new report I added for the UDC data that shows project pairings “in the wild”. In a comment, Nick effectively killed my weekend. Nick, my wife’s not happy with you. I showed her your picture. Be careful.

The report can now be sorted on columns. Actually, this part was easy to implement.

The hard part is that I noticed something when I started sorting the data on the different columns. I noticed that, while I expected that each pairing should be represented twice, some of them are only represented once. I expected to see, for example, a pairing of ‘ajdt’ and ‘platform’ along with a pairing of ‘platform’ and ‘ajdt’; but I only see one (the latter). I tried several different queries, and even tried more manually assembling the data (the final query is surprisingly simple, yet yields the same results as some of its more complicated cousins). I stumbled into two known MySQL bugs, and (possibly) one unknown one. To ensure that things stayed interesting, I opted to move the main query into a stored procedure (put the Data Tools Project’s SQL editing support into full use (though it was complicated by the fact that I had never once before ever created a stored procedure).

I’ll keep hacking at it, but in the meantime, I’ve made the new version available anyway.

In my efforts to refine the query, I discovered that I had previously been doubling the actual numbers (in my defense, I did state that I thought they felt a little high). That’s been fixed.

Once I can figure out a reasonable home for the queries, I’ll make ‘em available so that Nick can lose a weekend too.

I also spent a little time looking for a visualization package; something that will let me draw a diagram showing the relative proximities of the projects. I did stumble upon a neat little physics package that I figure I can use: each project can be represented as particle, with the number of users represented as the strength of a spring joining the particles. I think it’ll look cool. But, unfortunately, it’s become low priority; at least for the next week or so.

In the meantime, does anybody know of some decent software that can be used to represent this sort of information?

  • Pages

  • Archives

  • Categories