The items selected in a view are not tied closely to whichever editor is open . Switching editors, or even closing an editor, does not change the selection in a view by default.
Click the Link with Editor button.
Many views, such as the Resource perspective's Navigator view and the Java perspective's Package Explorer, enable you to synchronize with editors. To synchronize, click the Link with Editor button shown in Figure 2-8.
Figure 2-8. The Link with Editor button
By linking a view with an editor, you tie that view to the editor so that the view will always show the file currently being edited.