如何在 Eclipse 中复制和编辑文件?
这看起来很简单,但我找不到一个好的方法来做到这一点:
通常我想获取一个现有的(Java)文件并在其基础上创建一个新文件 - 基本上只需复制文件,重命名副本,然后编辑它。我找不到任何好的方法来做到这一点。我能做的最好的事情就是右键单击包资源管理器中的文件,选择复制,然后粘贴它。如果我在同一目录中执行此操作,系统会提示我更改其名称,这很酷。
这样做的问题是:1)它看起来不太“Eclipse-y”,2)通常我没有将 Package Explorer 扩展到源文件所在的位置,因此浏览所有项目非常乏味/packages 并找到它。
一定有更好的方法来做到这一点,不是吗?我期望重构菜单中有一些内容,但只有“移动”。
或者是否有一种简单的方法来显示我当前正在编辑的文件在包资源管理器中的位置?这并不理想,但对我来说已经足够了。
This seems so simple but I can't find a good way to do it:
Often I want to take an existing (Java) file and base a new one on it - basically just copy the file, rename the copy, and edit it. I can't find any good way to do this. The best I can do is to right-click on the file in the Package Explorer, select copy, and then paste it. If I do it in the same directory I'm prompted to change its name, which is cool.
The problems with this are: 1) It doesn't seem very "Eclipse-y", and 2) Usually I don't have the Package Explorer expanded to where the source file is, so it's very tedious to go through all the projects/packages and find it.
There must be a better way to do this, no? I expected something in the refactor menu but all there is is "move".
Alternative is there a simple way to show where a file I'm currently editing is in the Package Explorer? That wouldn't be ideal but would be good enough for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在包资源管理器的右上角,有一个“与编辑器链接”按钮,它将自动突出显示您在编辑器中打开的文件。
On the top right portion of the package explorer, there is a "link with editor" button that will automatically highlight which file you have open in the editor.
在编辑器的上下文菜单中选择“显示在 - 包资源管理器”。
Select 'Show In - Package Explorer' in the context menu of your editor.