Eclipse Resource Navigation
If you're like me, you probably have a lot of files open in Eclipse at any one time. You probably have done the following things at some time in your career:
- Moused over to an already open file whose tab is visible in your window
- Clicked on the little double arrow and drilled down to an already open file that wasn't visible in your window
- edited a file, saved it, opened another file to check something out, then wanted to go back to the place where you were last editing
This TimeSaver is dedicated to showing how Eclipse makes these operations a snap. Of course, we're talking about the keyboard. As you work with Eclipse, you'll learn that its developers are highly fond of keyboard shortcuts. Hit CTRL-Shift-L to see the current active shortcuts, also known as "Bindings".
Getting to open files quickly
First, put down the mouse. It's sucking time away from you and your precious code! Every time you find yourself grabbing the mouse to go to an already opened file, stop. Pinch yourself. Yank on the cilice. Whatever. But put the damn thing down. And hit: Ctrl-E Go ahead, try it right now. We'll still be here. Go to Eclipse, open up a few files, and then hit Ctrl-E. Pretty, isn't it? Notice how, like so many popups in Eclipse, it has a little area at the top where you can type? It's a filter. You can use wildcards, too. My favorite way to use it is when I know what file I'm looking for, let's call it "SomeTest.cfc", I hit Ctrl-E, type "So" and it'll filter down to the file I'm looking for. Hit Enter, and bam, you're at the file.
Back from whence you came
In that third scenario up above, you edited a file, went somewhere else, and then wanted to go back where you were. Eclipse has a shortcut for that: Ctrl-Q. Go ahead, try it.
Did it work? If you were editing a CFM or CFC file in CFEclipse, it probably didn't. That's OK. We're going to take care of that. CFEclipse overrides the Ctrl-Q binding with the "repeat last tag" action. I personally don't use that, so I want to get rid of it. Let's open up the Keys preference page. The sloooooow way: Window -- preferences -- filter on keys The fast way: Ctrl-Shift-L, Ctrl-Shift-L again. Go ahead, try it. It's going to pop up a window that looks like this. Now, in the filter box, type Ctrl+Q. Note the "+". You should see two entries. Simply remove the binding for "Repeat last tag" by selecting it and then clicking the "Unbind Command" button, or if you like that, you can assign it to another keyboard shortcut. Now, edit some text, move to another file, then hit Ctrl-Q. Bam... back where you were. Nice, eh?
I need to get to line 500... of line 2529
You know you've written some really long files in your day. Admit it. Sometimes, you actually have to maintain those works of modern art, and it's nice to be able to get quickly to where you need to go within that file. Usually this comes from a bug report with a tag context / stack trace attached to it. Simply hit Ctrl-L, then type in the line.
Ever wanted to just toggle through your open tabs? Simple: Ctrl-PgUp to go leftward through your tabs, and Ctrl-PgDown to go rightwards
The Back Button, Eclipse Style
I'll admit, this isn't one I use much, but maybe you'll get some mileage out of it. It's like your browser's Back button, but for Eclipse: Alt-Left Go ahead, try it. Guess how you go "forward".... yup. Alt-Right
Ctrl-E to navigate open files Ctrl-Q to go back to your last edit location Ctrl-L to go to a specific line Ctrl-PgUp and Ctrl-PgDown to toggle through your tabs Alt-Left and Alt-Right to go back and forth