- 25 Jul 2008 -

I was recently tasked with finding out the number of methods in each class in each package inside of OpenMRS. My first thought was to write a java class to do some reflection. My second thought was to find a java class that someone else had written and use that. My third thought was to find a way for Eclipse to do it.

I really should have jumped to that last one first.  Googling for my second thought gave me nothing useful.  However, simply adding “eclipse” to my search term brought up the Metrics plugin as the first result!  The Metrics plugin counts all different types of things.  Lucky for me, “number of methods” just happens to be one of them.

To get the counts working for you, follow these easy steps:

  1. Add http://metrics.sourceforge.net/update to eclipse as a plugin update site
  2. Turn metrics on for your project:
    1. Right click on the root of your project in Package Explorer view
    2. Choose Properties–>Metrics–>Enable Metrics
  3. Do an Eclipse clean rebuild
  4. Click on the root of your project in the Package Explorer
  5. Open the “Metrics” view

These are the relevant statistics from the OpenMRS project:

The second api/web are from the test package.  We have a lot of work to do to catch our total number of unit test methods up with our number of api methods.

I’ve also uploaded the entire OpenMRS metrics output.

This is in the openmrs category tagged as , ,

Add a comment »

…are the shortcuts.

I’ve been using control-shift-t extensively since Darius first showed it to me a few months ago.  It will let you quickly find and jump to a java class across your current workspace.  (There is also an Open Type button by default in eclipse that you can use.)

I’ve always wanted a way to do the same except with our jsp, xml, and properties files.  I know most of the names of files and know where they are, I’m just lazy.  I want to be able to jump to them without having to expand the whole tree.

Well, Open Resource to the rescue!  Control-shift-r works just like the Open Type except with nonjava files.  Woot!

This is in the babble category tagged as

1 comment »


…is that most of the other users of Eclipse are also software developers.  I’d bet that 75% of the users of Eclipse are capable of writing a plugin for it.  This is part of the reason there are tons of eclipse plugins, as I’ve talked about before.

Yesterday I was lamenting the fact that Eclipse doesn’t have a middle-click-closes-tab functionality as Firefox does.  It finally disturbed me enough to go and do a quick google search for it.  Lo and behold, out of those many other Eclipse-loving programmers out there, one of them felt as I did.

I now have the ability to close my tabs with a simple middle click thanks to Andriy Palamarchuk and the middle click closes tab plugin.

Plugin site: http://www.hlsoft.com/clickclosestab_eclipse
Plugin update url for eclipse: http://update.mousefeed.com/

This is in the babble category tagged as ,

Add a comment »


It always bothered me that after I edited files on the filesystem I would have to then explicitly tell Eclipse to “Refresh” in order to see them.  I stumbled across an option in the Preferences today that completely fixes it with just the click of a button!

Window –> Preferences –> General –> Workspace : Refresh Automatically

This the “File out of date” error I would get when copying and pasting files within Eclipse after an Ant build.  It also makes files appear magically in Eclipse when working directly with the filesystem (like when using Tortoise).

This is in the babble category tagged as

Add a comment »


The PIH developers used to have a daily tradition of sharing what new features and special tricks they found in Eclipse. I’ve had many such moments myself, albeit not nearly a daily thing…

Today, the thing I love about Eclipse is the abundance of plugins.  I sat here thinking, I wish I could control-click on an interface method and jump to the implementation of that interface.  The first hit in my google search gave me a plugin to install.  Now, instead of doing any silly looking for the Hibernate implementation of the ContextDAO, I can right-click on a method call, select “Open Implementation”, and boom, I’m looking at the HibernateContextDAO class.

You can find the implementation plugin described here http://eclipse-tools.sourceforge.net/implementors and the eclipse update site link is: http://eclipse-tools.sourceforge.net/updates/ .

The other very helpful plugins I have installed are:

  • Subclipse - http://subclipse.tigris.org/update_1.2.x
  • FindBugs - http://findbugs.cs.umd.edu/eclipse
  • FreeMem - http://www.junginger.biz/eclipse/

In addition, because I upgraded to Eclipse 3.3.1.1 (that last .1 is very important), I get built in jsp syntax highlighting.

This is in the babble category tagged as

1 comment »