Chapter 5 - Embedded Windows
IntelliJ has various Tool Windows, like the 1: Project window, 9: Version Control window, or 3: Find window.
When one of these embedded windows have focus, other shortcuts are available.
In this section we’ll discuss some of them.
Opening/Closing (Toggling)
⌘
All of these windows are accessible by holding down
⌘ and pressing the associating number.
e.g. If you want to open or close the 1: Project window, you press
⌘ + 1.
Switching tabs
⌘ + shift + [/]
Some of these windows have multiple tabs in them, i.e. the 6: TODO window. So let’s open that window, using
⌘ + 6.
You’ll notice that it contains the Project, Current File, Scope Based and Default Changelist tabs.
You can switch between these tabs by pressing
⌘ +
shift + [ and ⌘ +
shift + ].
Give it a try!
Navigation from Embedded Windows
⌥ + enter vs.
⌘ + ↑
Some Tool Windows will display results, like 3: Find and 8: Hierarchy, which you can use to navigate to directly.
There’s two ways of doing this:
⌥ + enter: allows you to navigate to your selected result, but focus remains on your Tool Window
⌘ + ↑: navigates to your selected result AND focuses the editor window in one go.
Let’s try ‘em both out.
We want to follow the path the code takes at runtime until we get to CoffeeBeans.scent(), so let’s trace back our steps from there by
opening CoffeeBeans.java, and
⌘ + ⌥ + F7 on the scent() method.
Use
⌥ + enter on CoffeeSmeller.smell(), see where it takes you, then ctrl + enter
on Chapter5.smellBeans().
We figured out we want to change something in CoffeeSmeller, so select CoffeeSmeller in the 8: Hierarchy tool window and instead of
pressing
⌥ + enter, press
⌘ + ↑.
Now we can change the implementation.
Why resizing is for dummies
shift + ⌘ + F12
Stop resizing your Tool Windows, use them when you need them (see Opening/Closing (Toggling)).
If you don’t need your Tool Window, you’ll want to focus back on your editor window. You can do this from anywhere (meaning, from any
focussed Tool Window) by pressing
shift + ⌘ + F12.
So, let’s first imagine we were looking at a hierarchy of CoffeeBeans.scent(), we looked at CoffeeSmeller’s use and we checked where in
the package structure CoffeeSmeller was situated by pressing
⌥ + F1.
Now we have both the 1: Project and 8: Hierarchy Tool Windows open. But we want to continue tweaking the CoffeeSmellers code, so let’s
press
shift + ⌘ + F12 and get our focus back on where it belongs, without any distractions.
Happy editing!