Friday, December 19, 2008

Gem uncovered in NetBeans - "run into method"

I love it when you discover something new in your IDE and it makes your life that much easier. There's that moment of joy, a surge of gratitude, as you realize some tiny bit of suffering in your life has been removed.

I was debugging a unit test, and there was a method I wanted to step into only when my particular test case that was failing was hit. This same method is called repeatedly, so I didn't want to put a breakpoint in it, or I would hit it over and over and over again until I got to the invocation I wanted to debug.

The problem is, once I was in there, I didn't want to step, step, step to get down to the actual method I wanted to step into from there. Capiche?

So what to do? Well, I though, it sure would be nice if I selected to the method I wanted to step into and just say "go there." What the heck, I said, let's put my cursor there, right-click, and see what happens. Magic, that's what!

run-into-method-1.jpg

Note how the method I care about is highlighted in yellow. That happens automatically when you click on it. Then notice the "Run Into Method" action in the drop-down menu.

Hey, why not, I tried it, and bingo, there I was! It's a thing of beauty I tell you!

run-into-method-2.jpg

No comments: