Instantly show a class/file in the Package/Project Explorer in Eclipse

While working on a class or XML file, you’ll often find that you want to work with the actual .class or .xml file in the Package Explorer, Project Explorer or Navigator views. You may want to copy, move or delete the file or do stuff that are only accessible in these views (eg. browse all files in the same folder).

Eclipse has a feature called Show In, that’s almost like a Quick Open. It instantly navigates to the current editor’s file in a requested view and positions you directly on the file in that view, no matter how deep in the hierarchy the file is. It’s also keyboard friendly, which means no more reaching for the mouse.

This feature is perfect for those (like me) who don’t like the Link with Editor functionality on certain views. I don’t like the Package Explorer to Link with Editor as I like to know things are the way I left them (see the rant at the end of the post).

How to use Show In functionality from the popup menu

There are two ways to invoke Show In:

  • The first way, described in this section, is the more general one, used to invoke any Show In option from a popup menu. Read this section first to get an idea of the overall functionality.
  • The second and fastest way is to map a keyboard shortcut to a specific view. This is perfect if you frequently use Show In with a specific view (eg. the Package Explorer). This is described in the next section.

The first way is to press Alt+Shift+W while you’re in an editor. This pops up a menu with a number of choices. The choices will vary depending on what plugins you have installed. Select the option you want and press Enter.

The fastest way to select an option is to use the first letter of the option, eg. to go to the Package Explorer, press P (you may have to do this 2 or 3 times depending on how many other options start with P). The press Enter. You could also use the arrow keys.

Here’s an example of what you might see.

Tip: Notice that you can also open the History view. A nice feature to keep in mind when you’re tracking down a bug introduced over different versions of the system.

Watch this video for a demo of how easy it is to delete a class from the Package Explorer. And all keyboard, no mouse.


  • You can also invoke the Show In with the mouse from the right-click menu or from the Navigate application menu.
  • Eclipse puts the most recently accessed view at the top, so the order changes depending on your usage. A nice feature that helps the next time you open the Show In menu.
  • The default Eclipse install supports limited views, eg. the Package Explorer, Project Explorer and History views. The list of views will change depending on what plugins you install.
  • The feature works with most files, eg. class, xml, txt, etc. So try using it when working with resource bundles or XML files as well.

Invoke Show In faster with a keyboard shortcut

If you frequently use one of the options (eg. Package Explorer), you can map a single keyboard shortcut to invoke it.

  • Go to Windows > Preferences > General > Keys.
  • Search for Show In. Eclipse will list a number of Show In options. In our case we want Show In (Show In Target Id: Package Explorer).
  • Select the command you want, enter a key in Binding and you’re done.

Pressing the key you assigned will now automatically jump to the class/file in the Package Explorer.

Wait up, doesn’t Link with Editor do this already?

Yes, it does, constantly and irritatingly slowly. For those who don’t know, Link with Editor () is a toggle that tells Eclipse to update the Package Explorer view whenever an editor or selection in the editor changes. It navigates to the file and optionally selects the current method.

If your Package Explorer is visible, Link with Editor navigates to every single class you jump to (eg. with F3) and opens up the folder hierarchy. 9/10 times I don’t want to work with the file, only the class contents. So it’s unnecessary work for something that’s also visually distracting.

And I prefer my Package Explorer to stay the way I had it before – it makes it easier for me to remember where I was and how to get to the state I want.

Another issue is that not all views support Link with Editor, eg. the Properties view and FindBugs’s Bug Explorer. For these views you need something like Show In to make navigation easier.

Link with Editor isn’t bad. It’s absolutely perfect for the Outline view. But for some views it just doesn’t work.

Related Tips

Share This Tip

Support Eclipse On E

5 thoughts on “Instantly show a class/file in the Package/Project Explorer in Eclipse

  1. I’m very very thankful to you for this valuable info….
    “How to use Show In functionality from the popup menu”
    “Wait up, doesn’t Link with Editor do this already?”
    I had been trying to search it for a few days but i needed the ‘Automatic Link In Feature’
    I had clicked on it accidentally and forgot how to turn it on.
    THANKS 🙂

    • fei, Ctrl+F10 doesn’t seem to toggle link with editor for me. By default it opens the system context menu for an editor or view. However, you can configure the shortcut for “Toggle Link with Editor” in the preferences. I am using Windows though so it might be configured differently from what you have.