tags:

views:

36

answers:

3

Ok, i have to fix somebody else's code, and basically on line 892 there's an ELSE/IF statement, but i can't find the original IF statement! The inconsistent nesting is making this extremely hard.

I've trailed up the code to see if i can find the original but i can't. Does anybody have any ideas how i can search for the originating IF statement besides scrolling with the mouse?

By the way, i'm using Eclipse. Thanks :)

+1  A: 

Why don't you press ctrl-f to format the code and then you should be able to line up the if/else statement. Also you could turn code folding on and close each set of if/else statements until you find it.

rainkinz
It's `Ctrl+Shift+F` :) The `Ctrl+F` launches the *Find/Replace*.
BalusC
A: 

If you put the marker at the end of the closing bracket the starting bracket will get a small gray box around it

getekha
+3  A: 

If you're using the CDT, Ctrl-Shift-P is "Go to matching bracket". It may also exist in vanilla Eclipse, PyDev, etc...

if(...) { ... } else { ... }

click on the bolded brace above and Ctrl-Shift-P your way to success!

dls
Neat, sure beats looking for a small gray box :)
getekha
yeah, and like anything else in Eclipse you can re-bind to another key combo if you find yourself needing to use this frequently...
dls
Excellent, that's exactly what i was looking for! :)
OOP_Master