跳转到代码行 Eclipse 快捷方式
在 Eclipse 中,是否可以使用快捷方式标记某些行并能够快速跳转到这些行?
示例:假设我的类中第 120 行有 MaintenanceHeavyMethod(),第 800 行有 gameLoop(),第 1460 行有一些侦听器
。按 CTRL+SHIFT+1、2、3 等来标记这些位置,然后使用 f.ex。 CTRL+1、2、3 立即跳转到它们。我不喜欢分屏等,但写作时需要跳来跳去。
有这样的功能吗?
我正在使用最新的 Eclipse 来编写 Java 程序。
is it possible, in Eclipse, to mark certain lines with Shortcuts and be able to quickly jump to those lines?
Example: Let's say I have maintenanceHeavyMethod() at line 120 in my class, gameLoop() at line 800 and some listener at line 1460.
I'd like to f.ex. press CTRL+SHIFT+1, 2, 3 etc. to mark those positions, and then use f.ex. CTRL+1, 2, 3 to immediately jump to them. I don't like split-screens etc, but I need to jump around when writing.
Is there such a feature?
I'm using latest Eclipse to write Java-programs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以在代码中添加书签。选择您想要添加书签的代码片段,然后转到编辑>添加书签...(也可以通过在编辑器左栏中右键单击提供的菜单,如断点)。
然后,添加书签视图。选择窗口>显示视图>其他...>>书签,您会得到如下内容:
遗憾的是,我认为您无法将快捷方式绑定到特定书签。
为了以防万一,跳转到特定行的快捷方式是 CTRL+L。
You can add Bookmarks in your code. Select the code fragment you want to bookmark and then go to Edit > Add Bookmark... (also possible via the menu available with a right-click in the left hand column of the editor, like breakpoints).
Then, add the Bookmarks view. Select Window > Show View > Other... > Bookmarks and you'll get something like this:
Sadly, I don't think you can bind a shortcut to a particular bookmark.
Just in case, the shortcut to jump to a particular line is CTRL+L.
这最好由 mylyn 来处理:
用这个定义一个任务三种方法,您将在包资源管理器视图中仅看到这 3 个方法
That would be best taken care by mylyn:
Define a task with this three method, and you will be to see only those 3 in the package explorer view
要跳转到特定方法,我使用 ctrl+o,然后开始输入该方法。如果您是一位熟练的打字员,这应该不会花费更长的时间;请记住,您只需开始键入方法的名称。
不幸的是,这不是跳转到方法内代码行的正确解决方案。
To jump to a particular method, I use ctrl+o and then start typing the method. If you're a proficient typist, this shouldn't take any longer; keep in mind that you only have to start typing the name of the method.
Unfortunately this isn't a proper solution for jumping to a line of code within a method.
您可以使用大纲视图跳转到方法。大纲视图显示当前打开的源文件的所有方法、字段和内部类(及其方法、字段和内部类...等)。我个人更喜欢这种方法,除非我有堆栈跟踪并且知道我想跳转到哪一行,在这种情况下我使用 ctrl+L。
You can jump to methods by using the outline view. Outline view shows all the Methods, Fields, and Inner-Classes (and their methods and fields and inner-classes...etc) of the source file you currently have open. I personally prefer this method, unless I have a stacktrace and know which line I want to jump to, in which case I use ctrl+L.