How do I show an open file in eclipse Package Explorer?

Eclipse

Eclipse Problem Overview


When a file (.java for example) is open in Eclipse, how do I get the Package Explorer to show the file that I am working on?

Eclipse Solutions


Solution 1 - Eclipse

There is a button in the Package Explorer view that looks like two yellow arrows pointed at left and right. The tooltip is "Link with Editor". Click that.

Solution 2 - Eclipse

I've found that constantly syncing package explorer with editor causes package explorer view eventually to grow too long, especially with large projects. I've instead mapped a keyboard shortcut to sync package explorer with the editor. If you are using mylyn this is of course a smaller problem.

Key mappings are available at Window ⟶ Preferences ⟶ General ⟶ Keys ⟶ Show In (Show In Target Id: Package Explorer). Mine is Ctrl+Alt+, be welcome to copy.


In Luna Command name has changed a little. Instead of Show In (Show In Target Id: Package Explorer) command is now Show In (Package Explorer).

Solution 3 - Eclipse

From this site:

How to use Show In functionality from the popup menu

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.

enter image description here

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.

Always link active source file with package explorer

If you like this feature, you can open the package editor and click on the double yellow arrows to always show the currently selected source file in the package explorer.

Solution 4 - Eclipse

There is a double arrow icon at the top of the Package Explorer that toggles this behaviour. click on It

enter image description here

Solution 5 - Eclipse

In your Eclipse .java file editor, right-click anywhere, then "Show In-> Package Explorer".

As shown:

Image

As you can see, you can also open file in Navigator, Outline and so on with this.

Solution 6 - Eclipse

Above project explorer window you will see the below image in the red circle , just clicked on this one mean when clicked any file in the project will showing you in project explorer.

enter image description here

> If you want to show only one file you can

1 - Click right on the file .

2 - Select show-in .

3 - Select show in project explorer .

4 - Done.

The below image explain more about it .

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBohnView Question on Stackoverflow
Solution 1 - EclipseKonstantin KomissarchikView Answer on Stackoverflow
Solution 2 - EclipseAheView Answer on Stackoverflow
Solution 3 - EclipseJeff AxelrodView Answer on Stackoverflow
Solution 4 - EclipseLathaView Answer on Stackoverflow
Solution 5 - EclipseKai ShenView Answer on Stackoverflow
Solution 6 - EclipseAbd AbughazalehView Answer on Stackoverflow