Tuesday, January 25, 2011

ClearCase inside! - Eclipse interface

Our Eclipse application upholds hundreds of resources. As usual for good team work, all these resources are controlled by IBM Rational ClearCase. Usually, each user, going to work with some resource, opens ClearCase Explorer, checkouts this resource file, returns to our application and keeps doing his mission. If another user has to work with the same resource and try to checkout this resource in the ClearCase Explorer, he gets the message informing that this resource is checked out by named user and he can to work with unreserved copy of this resource. In practice, most of our users just change the "read-only" property of this resource and make their changes as well. Furthermore, such "careless" user usually does not keep in mind to merge his work with results of the another one. A lot of times I was called to help to such "duffers" to save theirs day (or week) work and to restore lost information.

Naturally, the best way to stave off such bad practice is to add the ClearCase functionality to our application - to add proper GUI action and to implement at least checkout and checkin operations.
Unfortunatly, I could not find any Java interface to the IBM Rational ClearCase Eclipse plug-ins. The standard Eclipse plug-ins we use do not contain the source code.
The solution, with "little help of" Cavaj Java Decompiler see below:

1. First of all, let us add the standard "Connect ot Rational ClearCase" action to your perspective:


2. To get connection to ClearCase call:

This variable can be used as a handle to ClearCase plug-in. All known ClearCase operations can be executed using this handle.
For example, to check if application is connected to ClearCase, use method:

3. To checkout resource:

4. To checkin:


Now it's trivial to add all ClearCase actions (Checkin, Checkout, Hijack, Add to Source control, and so on, to each application resources.
The attempt to edit checked-in resource brings to standard "Checkout Element(s)" dialog:

No comments:

Post a Comment