Tuesday, July 31, 2007

JREFinder/Injector works, period

I just committed the code that completes (functionally, at least) my JREFinder/Injector pair. The JREFinder checks a number of locations and installs any JREs it finds there. I recently added a polling mechanism to the underlying Discovery plug-in that makes it poll all such "found" JREs and notifies its clients when these JREs no longer exist. JREInjector is one such client, and when it gets the "unfind" event, it uninstalls the JRE that was unfound. Thus, when I run my Eclipse app, I can install multiple JREs and they're automatically add to the JRE Preferences list. Then, I can go and delete or rename the JREs and they're taken off the list...automatically!

For everyone who contributed the locations of their JRE installs, Thank you very very much.

Monday, July 23, 2007

JREFinder works (almost)

So, at the end of last week, I'd gotten my JRE Injector (the plug-in that injects JREs found by the Finder into Eclipse's preferences page) working. However, when I open the Preferences page and check the list of installed JREs, I only see the last JRE injected. All the others don't show up! Very strange. The good thing is that this week, I'll be putting JREFinder/JREInjector on the back-burner and beginning work on a new project to provide discovery services for. What'll it be? C/C++ Development Tooling? PHPEclipse? I'll let you know once my esteemed mentors give the word.

This past weekend, I participated in the ICFP programming contest. It was *hard* and I only finished writing the first part of the interpreter (DNA->RNA) on Sunday night. I'd used Java and abandoned it, then moved onto PLT Scheme (shooting my productivity up). However, I got screwed by type errors and not being able to debug programs in as fine-grained a manner as in, say, GDB.

So now I'd like to know, are there any statically typed programming languages out there (preferably functional) that have a good IDE (auto-completion is nice), a debugger that allows you to examine variables anywhere along the execution path, and a graphical testing framework (kinda like Eclipse's JUnit)?

P.S. my team name was Ogachyuallincheck and as you'll notice, I wasn't last :-)

Monday, July 16, 2007

Call for entries...

So, as part of creating an auto-configuration framework for Eclipse, I'm writing an example plugin that tries to find the installed Java Runtime Environments on a system. It'll be done heuristically and not with an exhaustive search and so I need your help. Please tell me, in the comments pages, the path to where you have installed the JREs on your system (Linux, Windows, Mac, whatever) so I can compare and extract heuristics from them. If you're running Eclipse, you can find the locations by going to Window > Preferences... > Java > Installed JREs. Mine, by the way, are at C:\Program Files\Java\j2re1.4.2_15 and C:\Documents and Settings\onnadi3\Desktop\eclipse3.3\weme-win-x86-ppro10_6.1.1.20061110-161633. Thanks, folks.

By the way, last week, 5 years since I started taking piano lessons, I finally played the last song in my Essential Keyboard Repertoire. I can finally claim the title of intermediate level-pianist. *sniff* Ms. Rivadeneira would be so proud...

Tuesday, July 10, 2007

Inserting JVMs into Eclipse

As one of the use cases for my Summer of Code project, an auto-configuration plugin for eclipse, I've been trying to automatically detect installed Java Runtime Engines (JREs) on a system and load them into Eclipse's list of installed JREs. It ain't easy, lemme tell ya.

I first tried to insert the JRE's data directly via the Preferences API. That didn't work because format in which they're stored in the Prefs is not API, hence there are quite a few values that have to be set *very* carefully.

I next tried to dynamically load an extension for adding JREs to the list using IExtensionRegistry.addContribution but that method wouldn't let me add persistent entries. I got an idea from Phillipe to create a plugin with an extension point which I would load from disk as needed and wala! have dynamically added JRE entries. Eventually the idea was scrapped, because there was a seemingly easier way to do it using the VMStandin class.

I tried using it for a while, even resorting to using internal APIs but I kept getting weird exceptions. Then I cam in to work this morning and after updating, I noticed that Markus had kindly gotten the VMStandin class to properly insert JREs into Eclipse's list. This was one chunk of code that I was very grateful to see. Here it is for your enjoyment:

// Take the first VM install type that claims the location as a
// valid VM install. VM install types should be smart enough to not
// claim another type's VM
for (int j = 0; j < vmTypes.length; j++) {
IVMInstallType type = vmTypes[j];
IStatus status = type.validateInstallLocation(location);
if (status.isOK()) {
VMStandin standin = new VMStandin(type, type.getId());

In other news, H.P. Lovecraft has just reintroduced me to the joys of reading horror. I just read The Tomb and was blown away by the imaginativeness of the stories and the flowing flowery language. And I also discovered that he is the source of famous names as Sephirtoh, Chthon, Alhazred, and Arkham.

Thursday, July 5, 2007

Status update

This is my a status update for today's Eclipse SoC meeting. You can join us on Thursdays at noon (EDT) in #eclipse-soc.

My goals for this week were:
  1. Make JREFinder check in a few places for JREs
  2. Package it as a feature
  3. Add to SoC CVS
  4. Write the "jdt preference injector" which injects discovered values into the corresponding jdt preferences.
#1 Make JREFinder check in a few places for JREs: I wrote an example JRE finder that searches in Program Files for installed JREs; works only on Windows.

#2 Package it as a feature: I found out how to do so here http://wiki.eclipse.org/index.php/FAQ_How_do_I_create_a_feature%3F . I shall package my project as a feature once the other three items are done.

#3 Add to SoC CVS: Done. Our code is now available at soc.eclipse.org:/cvsroot/soc/org.eclipse.soc.discovery. Thanks, Markus :-)

#4 Write the "jdt preference injector" which injects discovered values into the corresponding jdt preferences: I'm still working on this. The classes that allow me to inject values into JDTs list of VMs are in an internal package and so I can't use them. I have sent an email to the jdt-core-deve mailing list asking for help with this problem.