Archive for October, 2007

Holding Court

Thursday, October 11th, 2007

One of the more interesting conference phenomenons is the informal court. These tend to spontaneously form around the some of our more well-known luminaries. Here’s a picture of Ed Merks holding court in the common area of Eclipse Summit Europe. The group has grown by another three people since I started typing.

merks.jpg

Ed is the technical lead for the EMF project.

Eclipstation

Wednesday, October 10th, 2007

The Ingres folks are showing off their Eclipse Data Tools Project (DTP) integration at Eclipse Summit Europe. The best part is that they’ve presented me with the holy grail: a potentially justifiable reason to get the Eclipse Foundation to buy me a Playstation 3.

ingres.jpg

They’re demonstrating Eclipse, running the DTP with Ingres support on the Playstation (running Fedora Linux). It’s a little memory constrained, but is able to run both the SDK and an Eclipse RCP application that uses the database.

Now Mike, about that $600 expense for hardware…

Follow me to Riena

Tuesday, October 9th, 2007

I think that I’ve mentioned before that I’m excited about the Riena project. So are some other people attending Eclipse Summit Europe.

followme.jpg

We had a presentation from Alex Ziegler about Riena at the RCP Experience Workshop which was well-received by everybody at the workshop. Alex is the project lead and lead architect of the proposed project. The Riena proposal includes an authorization and authentication mechanism that’s intended for communication between client and server. We discussed potentially leveraging this work as part of an extension to the expressions framework I mentioned in my previous post.

I think that one of the bigger challenges that will be faced by this project is containing its scope.

Authentication and Authorization at the RCP Experience Workshop

Tuesday, October 9th, 2007

The first hour (of four) of the RCP Experience Workshop at Eclipse Summit Europe is over. The main topic of discussion thus far has been authentication and authorization. Essentially, the concern is that of hiding (or at least disabling) features based on permissions (authorization) of the user. Several ideas have been bounced about.

This is a pretty fundamental concept that is an important part of many RCP applications. Buttons, menus, views, editors, and more need to be controlled. A role-based scheme was suggested; ideally, different bits of functionality can be declaratively ‘marked’ as being appropriate for certain roles. The platform project is probably most ideally suited to solve this, but there are other possible approaches. One suggested approach was to use aspects to tune the behaviour of existing classes. It was also suggested that activities might suit the bill. Another possibility is to use the Equinox transformation functionality to dynamically change plugin.xml files as they are loaded to exclude functionality that we don’t want to expose to the current user.

I found the last suggestion very interesting. It was suggested that we consider extending the expression framework to permit expressions based on user role. This has the benefit of already being used by the command framework and so will be immediately available for toolbar buttons and menus. Unfortunately, the expression framework isn’t used by views, editors, wizards, and lots of other useful bits. Even with this apparent restriction, this option seems pretty viable.

The workshop continues. Further updates as events warrant…

Festival Seating

Monday, October 8th, 2007

There will not be reserved seating and nobody will be turned away at the RCP Experience Workshop at Eclipse Summit Europe. That said, I’d like to give priority seating to those who have actual experiences to share (being as this is the focus of the workshop). I’d like to ask (politely and respectfully) those of you who are attending purely out of interest to please linger a little longer over breakfast to give those folks who are prepared to present their experiences a chance to get in first. See you tomorrow!

RCP Experience Workshop Format

Monday, October 8th, 2007

I’ve updated the RCP Experience Workshop wiki page to include a section on format. The short version is that we’re going to ask 2-3 people to stand up in front of the crowd and present their experiences with RCP. Each person will get 20 minutes. I’ve asked the folks representing the Riena project to present their proposal after the experience reports. Then, we’ll do a brainstorming session to discover and document the issues that folks are having with RCP, and get a good start on developing a strategy for fixing what ails us. We’ll capture all this on the wiki. Be warned, I’m looking for volunteers…

Is it just me, or does the name Riena make you think of the Fleetwood Mac song Rhiannon? Would you stay (commit) if she promised you heaven? Will you ever win. It’s probably just me.

Getting started with Properties

Monday, October 8th, 2007

Over the last few days, I’ve been communicating with a developer who was having trouble getting the Properties view to work with his view and objects. It turns out that the real problem was more a lack of understanding of the adapter framework. I came up with three progressive examples to demonstrate their use.

Using the Properties view is simple enough. Since it shows properties for the selected object, the first step to using it is to make sure that the workbench selection service knows about the object selected in your view. There’s an entire Eclipse Corner article written on the subject of the selection service. You can find that article here. The short version, assuming that your view uses a JFace table or tree viewer, is to include something like the following in your createPartControl method:

...
public void createPartControl(Composite parent) {
	viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer.setContentProvider(new ViewContentProvider());
	viewer.setLabelProvider(new ViewLabelProvider());

	getSite().setSelectionProvider(viewer);

	viewer.setInput(getViewSite());
}
…

I’ve marked the important part in bold. Once you have your view contributing to the workbench selection, you need to make sure that the objects that your view is selecting contribute properties. The easiest (but not necessary most correct) way to do this is to have your class implement the IPropertySource interface:

...
public class Person implements IPropertySource {
	private String name;
	private Object street;
	private Object city;

	public Person(String name) {
		this.name = name;
		this.street = "";
		this.city = "";
	}

	public Object getEditableValue() {
		return this;
	}

	public IPropertyDescriptor[] getPropertyDescriptors() {
		return new IPropertyDescriptor[] {
				new TextPropertyDescriptor(”name”, “Name”),
				new TextPropertyDescriptor(”street”, “Street”),
				new TextPropertyDescriptor(”city”, “City”)
		};
	}

	public Object getPropertyValue(Object id) {
		if (”name”.equals(id)) return name;
		else if (”street”.equals(id)) return street;
		else if (”city”.equals(id)) return city;
		return null;
	}

	public void setPropertyValue(Object id, Object value) {
		if (”name”.equals(id)) name = (String)value;
		else if (”street”.equals(id)) street = (String)value;
		else if (”city”.equals(id)) city = (String)value;
	}

	public boolean isPropertySet(Object id) {
		return false;
	}

	public void resetPropertyValue(Object id) {
	}
}

In this example, my object has three properties that are all text values. I’ve marked in bold one of the property descriptors that defines the behaviour of the property in the Property view. The first parameter is the name of the property, and the second one is the label for that property in the view. There are other types of property descriptors that you can use; you can even make your own if you have a special type of property.

I’ve kept this example deliberately simple. My properties cannot be reset, nor does the implementation have any notion of whether or not properties have been set. A more sophisticated implementation will provide the user with more sophisticated options.

I indicated earlier that this solution is “not necessarily [the] most correct”. This is because, for this to work, my domain object needs to know about the very view-centric (and Eclipse-centric) notion of being a property source; in short, there is a tight-coupling between the model and view and this not a good thing™. This where adapters come in. I’ll introduce adapters in the next installment.

In the meantime, if you want to learn more about properties in Eclipse, check out these articles.

RCP Experience Workshop Wiki Page

Sunday, October 7th, 2007

I’ve created a page for the RCP Experience Workshop at Eclipse Summit Europe on the Eclipse Wiki. Right now, the page only contains a description of the workshop and a list of the names of folks who asked to attend. The list is made from my mail log, so I may have missed somebody. If you’d like to attend, feel free to add your name to the list. Also feel free to add any helpful materials to the page (like a link to your position paper or other useful things). You can upload materials to the wiki if you need a home for them.

I intend to post results from the workshop here; we’ll likely use the page during the workshop to keep track of ideas and capture thoughts, results, etc.

At the same time, I’ve created a new page named “Workshops” as a collecting point for this and other workshops. I’ve added links to the results from the CDT and Equinox Summits.

Napoli, Eclipse-IT, and Pompeii

Friday, October 5th, 2007

Ralph and I attended the ECLIPSE-IT International Conference hosted by the Faculty of Engineering at the University of Napoli Federico II this week in Naples, Italy. Ralph did a great presentation on building innovation networks. Mine was on one of my favourite topics: test-first development. Frankly, I’m not 100% happy with my delivery (I’ve done better), but I think it went okay (after they told me to slow down). Unfortunately, all the other speakers that were speaking in Italian so I couldn’t understand very much of what they were saying (I apparently know enough bits and pieces of various languages to frequently get a gist of what was being said). One of the talks leads me to believe that the Italian government is making its way into the open source world, which is goodness.

From the show of hands during my talk, it seems that most (if not all) of the students, researchers and faculty at the university (at least the ones doing software) are using Eclipse. There were also a handful of posters covering some Eclipse-based research areas. There’s a heck of a lot of Eclipse work happening at the university. In fact, there’s a heck of a lot of Eclipse work going on at lots of universities.

pompeii.jpgAfter the morning sessions, Ralph and I decided to do a little touring and visited Pompeii. Pompeii is pretty amazing. Ralph has posted a bunch of pictures here if you’re interested. Assuming that we survive one more trip in a taxi (the traffic here is… aggressive) we’re making our way back to Germany tomorrow morning to gear up for Eclipse Summit Europe. See you there!

As an aside, why do we call it Naples when the locals call it Napoli? That just doesn’t make any sense to me…

equals() and hashcode() oh my!

Tuesday, October 2nd, 2007

While communicating with a colleague today, I was reminded today about how painful explaining equals() and hashcode() to new Java developers can be. What’s particularly frustrating is that it’s not really a Java issue. I remember learning all about the ins and outs of equality and hash in Smalltalk, and then struggling to help others understand. It’s one of those classic computer-sciency problems that I used to use as a discussion point when interviewing potential co-op hires; I don’t recall ever finding a student who really understood it, but it helped me sort out the ones who could at least start solving a problem. When it comes down to it, understanding how best to implement these two methods is just plain hard.

Since this continues to be laboured about in numerous forums, I really don’t want to get into the specifics of how these methods should be implemented. For what it’s worth, I can’t remember the last time I actually implemented these methods. I’ve been building enterprise applications for many years now, and I can’t honestly remember actually needing these methods in my domain objects. That’s probably not an accurate reflection of reality; I probably just don’t remember implementing them.

I’m not sure what the point of this posting is. Maybe, it’s that—despite having lots of great infrastructure, frameworks, and APIs—there are just some fundamental concepts you really need to understand in order to do good stuff. Or maybe I’m just mumbling…

You are currently browsing the Eclipse hints, tips, and random musings weblog archives for October, 2007.

  • Pages

  • Archives

  • Categories