如何在 eclipse Package Explorer 中显示打开的文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6334241/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:15:07  来源:igfitidea点击:

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

eclipse

提问by Bohn

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?

当文件(例如 .java)在 Eclipse 中打开时,如何让包资源管理器显示我正在处理的文件?

回答by Konstantin Komissarchik

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.

Package Explorer 视图中有一个按钮,看起来像两个指向左右的黄色箭头。工具提示是“与编辑器链接”。单击那个。

回答by Ahe

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.

我发现不断将包浏览器与编辑器同步会导致包浏览器视图最终变得太长,尤其是对于大型项目。我已经映射了一个键盘快捷键以将包浏览器与编辑器同步。如果您使用的是 mylyn,这当然是一个较小的问题。

Key mappings are available at Window -> Preferences -> General -> Keys -> Show In (Show In Target Id: Package Explorer). Mine is ctrl-alt-left arrow, be welcome to copy.

键映射可在Window -> Preferences -> General -> Keys -> Show In (Show In Target Id: Package Explorer)。我的是ctrl-alt-left arrow,欢迎复制。



Edit: 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).

编辑:在 Luna Command 中,名称发生了一些变化。而不是Show In (Show In Target Id: Package Explorer)命令现在Show In (Package Explorer)

回答by Jeff Axelrod

From this site:

这个网站

How to use Show In functionality from the popup menu

如何使用弹出菜单中的 Show In 功能

Press Alt+Shift+Wwhile 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.

Alt+ Shift+ W,而你在编辑器中。这会弹出一个包含多个选项的菜单。选择将根据您安装的插件而有所不同。选择您想要的选项并按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.

选择选项的最快方法是使用选项的第一个字母,例如。要转到包资源管理器,请按P(您可能需要执行此操作 2 或 3 次,具体取决于有多少其他选项以 P 开头)。新闻界Enter。您也可以使用箭头键。

enter image description here

在此处输入图片说明

Invoke "Show In" faster with a keyboard shortcut

使用键盘快捷键更快地调用“Show In”

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

如果您经常使用其中一个选项(例如 Package Explorer),您可以映射单个键盘快捷键来调用它。

  • 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.
  • 转到 Windows > 首选项 > 常规 > 键。
  • 搜索显示。Eclipse 将列出许多 Show In 选项。在我们的例子中,我们想要 Show In(Show In Target Id: Package Explorer)。
  • 选择你想要的命令,在绑定中输入一个键,你就完成了。

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.

如果您喜欢此功能,可以打开包编辑器并单击双黄色箭头以始终在包浏览器中显示当前选择的源文件。

回答by Latha

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

包资源管理器顶部有一个双箭头图标可切换此行为。点击它

enter image description here

在此处输入图片说明

回答by Kai Shen

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

在您的 Eclipse .java 文件编辑器中,右键单击任意位置,然后单击“Show In-> Package Explorer”。

As shown:

如图所示:

Image

图片

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

如您所见,您还可以使用它在导航器、大纲等中打开文件。