Sunday, August 14, 2005

Surfin' Eclipse Source...

When I last left this saga, I was thinking I would try to fix the "embedded comments in new class template" problem. I started trying to look through the source to find the place in the code where the class template was inserted into the code.

The first problem was figuring out how to get the source to do the surfing. Generally, Eclipse is too big and complicated for any single person to build the whole thing from scratch. If you look through the discussion groups and search for "build from source" or some such, you'll find some soul asking the insiders how to get the last revision from CVS and build eclipse from the source. The answer refers this inquisitive soul to the general documentation front page with no further comment. This is equivalent to telling him to take a flying leap into the lake and soak his head. At least they didn't preface it with "RTF...."

The way that Eclipse supports for building and correcting itself is to allow intrepid developers to import a plug-in at a time as a source project, and make changes, build, and integrate using the PDE. This is explained in "The Java Developer's Guide to Eclipse" (D'Anjou et al, 2nd edition) on page 972. By the way, this book is turning out to be quite a helpful resource for this project.

However, if you don't know which plug-in to look in first (which I don't) you may want to get some copy of the source and surf around in it 'till you find the likely spots for your change. In this case, you can get a copy of the whole shebang of the source by means of the nightly builds. The nightly builds are not really "builds" in the sense that they don't successfully build. They are just a pull of the source from whatever happens to be at the head revision of CVS that night. Nice that they made this available to non-committers so you can surf the source without having to go through any rituals. Since we're just surfing, no need for the thing to be free of compilation errors. If you click on the "nightly build" link in the downloads page (http://www.eclipse.org/downloads/index.php), you will usually have the choice of a "source included" or a "source fetch" download, and then some versions for specific platforms. I chose the "source included" download because the source fetch was one more thing to figure out. The download is big at around 65 meg, and the servers are frustratingly slow at around 10k/sec. So it takes 2 or 3 hours a download and 1 out of 3 downloads just craps out for no good reason.

Once I find the plug-in I'm looking to change, my plan is to download the latest integration build and go the "import as source project" route, unless when I finally contact the Eclipse-o-fites, they tell me to do it a different way.

BTW, a nice summary of the different types of builds is available if you go to the download page and click on the link "For information about different kinds of builds look here."

Another BTW, one time the "source included" download was not available, and the nightly download was the same as the "integration build" download. I haven't been doing this often enough to know if it happens every integration or if it was a one-time mistake. The "source included" build reappeared the next night. There's also an option to look through the archives, but I haven't explored it yet.

Once you get a copy on your local file system, unzip the unholy mess into a directory. Then it's up to your favorite build environment. I use Eclipse, so I fired it up, created a new project, and pointed it at the source directory. After about a half hour of grinding the disk, it came up with a few hundred errors. Many of these were the "import cannot be resolved" category. These can be fixed if you need (or are obsessive) by adding the package in question to the source path. Many just look like half-implemented features.

Eclipse is awfully big for itself to run as a project, so workspace saves are lengthy. I was able to surf around successfully in the Eclipse source and started searching for the spot where templates are inserted. One nice thing to say about Eclipse (lest you think that all I do is complain) is the "References" and "Open Declaration" menu items in the drop-down menu are very handy for finding needles in haystacks.

Next - will he find this particular needle, or just a lotta hay?

0 Comments:

Post a Comment

<< Home