With so many views in Eclipse (around 50 for a default install), it can become difficult to navigate them all, especially when you don’t want to reach for the mouse all the time. As I’ve mentioned in a previous post on how to manage keyboard shortcuts, learning how to use the keyboard efficiently can save you oodles of time later on.
Fortunately, Eclipse has a number of ways to navigate between views using only the keyboard. I’ll discuss the Show View shortcuts, the Show Views dialog, Quick Access and then view cycling, with some advice on when to use which one. There’s also a bonus tip on how to activate the editor with the keyboard once you’re done with a view.
Navigate between views using shortcuts
The fastest way to get around views, is to use the Show View keyboard shortcuts that take you directly to a view, no matter where you are in the window. The Show View commands are activated by pressing Alt+Shift+Q, then the letter for the relevant view, eg. to navigate to the Package Explorer, press Alt+Shift+Q, P.
The Show View command opens the view if it’s not opened in the current perspective, makes it visible then activates the view. So you can even open views that aren’t already open in the perspective.
Here’s a list of common views that you’ll probably use every day as a Java developer:
|Alt+Shift+Q, P||Package Explorer|
|Alt+Shift+Q, O||Outline View|
|Alt+Shift+Q, X||Problems View|
|Alt+Shift+Q, S||Search View|
|Alt+Shift+Q, T||Type Hierarchy|
|Alt+Shift+Q, Y||Synchronise View|
You may want to change the shortcut for a view that you use often to open it faster (eg. make Alt+Shift+P navigate to the Package Explorer). On the Keys preference dialog, search for Show View. Eclipse will list all views that are registered with the workbench. You can now reassign the key to your favourite view.
Some views don’t have shortcuts assigned to them, only waiting for you to do the honours. Again, you can use the Keys preference dialog to assign a shortcut to an unassigned view.
As always for the forgetful, to quickly get a list of all available Show View shortcuts, press Alt+Shift+Q, release it and wait for the list to appear in the lower right corner of the screen. It should look something like this:
Show views dialog
The next fastest way to navigate views is to press Alt+Shift+Q, Q. This pops up a dialog with a list of all views Eclipse knows about. The dialog is grouped by category and comes with a handy search box for you to easily find the view you want. The search box supports wildcards — a handy feature if you don’t know the exact name of the view you’re looking for. Once you’ve chosen the appropriate view, just press Enter.
Here’s an example of what the dialog looks like when you use the search feature:
You can also use the arrow keys to move to the view of your choice: Up/Down to move to the next folder grouping or view and Left/Right to open a folder. But I would recommend getting used to the search box as it’s faster to get to the view you want.
Tip: If the view you want is at the top of the list, you don’t have to press Down to select it. Pressing Enter will select the first view in the list and then pressing Enter again will confirm your selection.
Navigate views using Quick Access (Ctrl+3)
Quick Access is a way to navigate to anywhere or invoke anything in Eclipse. By pressing Ctrl+3, Eclipse pops up a searchable list of all perspectives, views, preferences, commands, etc. that it knows about. It sounds far-fetched, but try it out yourself to see what I mean.
You can navigate to a view by typing its name in the search bar. The search supports implicit wildcards, so you don’t have to type an asterisk to do a wildcard search. So to navigate to the Package Explorer, you can type Package in the search bar.
This is an example of what you’ll see when you use this dialog’s search feature:
Unfortunately you may get a lot of other entries that match the word Package since other things like commands and preferences may contain the same word. This gives the Show Views dialog a slight edge over Quick Access when it comes to navigating views since it only shows views.
Cycle views (Ctrl+F7)
This is probably the slowest and most frustrating way to navigate views. By pressing Ctrl+F7 (Next View), Eclipse pops up a list of all open views in the current perspective. To cycle through the list, hold down Ctrl and press F7 repeatedly.
Here’s what the list looks like:
There are 2 big problems with view cycling, though, which makes it one of my least favourite commands:
- If the view you want is at the bottom of the list, it takes a while to reach it. And if you accidentally move past it, you need to wrap around and try and hit it again, or you have to swap over to Ctrl+Shift+F7 to move backwards in the list. Definitely not nice.
- The list only shows open views in the current perspective. Not usable if you want to open an infrequently used view.
However, this shortcut does come in handy when you’re constantly swapping between two views (eg. doing a side-by-side comparison). By pressing Ctrl+F7 once, Eclipse switches between the currently active and last active view.
Activate the editor using the keyboard
You may want to know how to use your keyboard to give the editor focus once you’re done with a view, especially helpful if you’re avoiding the mouse.
To activate the editor from any view, press F12. This means that you don’t have to reach for the mouse to start editing. This command is called Activate Editor and can be changed to any shortcut you want. F12 is not the most convenient key on most keyboards, so you may want to change it if it doesn’t suit you.
So, when should you use one or the other?
I would recommend the following to start off with:
- For frequently used views, learn the Show View keyboard shortcut (eg. Alt+Shift+Q, P) for the Package Explorer. It’s the fastest and most direct way to get to a view.
- For infrequently used views, learn to use the Show Views dialog, or alternatively Quick Access. The Show Views dialog is better because it only contains a list of views, so it makes things a bit simpler than the Quick Access dialog.
- Use Next View (Ctrl+F7) only when you’re constantly swapping between two views. Avoid it for other scenarios.
So now that navigating views is a bit easier, here are some other tips that may come in handy:
- Quick ways to navigate Eclipse editors using the keyboard
- The fastest ways to open editors in Eclipse using the keyboard
- Categorise projects in the Package Explorer to reduce clutter in Eclipse
- Use Fast Views to maximise screen space
- Split and view the same editor side by side in Eclipse
- Switch and close editors faster with the keyboard using Eclipse’s Quick Switch Editor
- How to manage keyboard shortcuts in Eclipse and why you should