跳转到代码行 Eclipse 快捷方式

发布于 2024-08-29 02:31:56 字数 373 浏览 5 评论 0原文

在 Eclipse 中,是否可以使用快捷方式标记某些行并能够快速跳转到这些行?

示例:假设我的类中第 120 行有 MaintenanceHeavyMethod(),第 800 行有 gameLoop(),第 1460 行有一些侦听器

。按 CTRL+SHIFT+123 等来标记这些位置,然后使用 f.ex。 CTRL+123 立即跳转到它们。我不喜欢分屏等,但写作时需要跳来跳去。

有这样的功能吗?

我正在使用最新的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

少年亿悲伤 2024-09-05 02:31:56

您可以在代码中添加书签。选择您想要添加书签的代码片段,然后转到编辑>添加书签...(也可以通过在编辑器左栏中右键单击提供的菜单,如断点)。

然后,添加书签视图。选择窗口>显示视图>其他...>>书签,您会得到如下内容:

alt text

遗憾的是,我认为您无法将快捷方式绑定到特定书签。

为了以防万一,跳转到特定行的快捷方式是 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:

alt text

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.

心欲静而疯不止 2024-09-05 02:31:56

这最好由 mylyn 来处理:

用这个定义一个任务三种方法,您将在包资源管理器视图中仅看到这 3 个方法

http://www.tasktop.com/sites /default/files/images/part1-overview.jpg

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

http://www.tasktop.com/sites/default/files/images/part1-overview.jpg

早茶月光 2024-09-05 02:31:56

要跳转到特定方法,我使用 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.

青衫儰鉨ミ守葔 2024-09-05 02:31:56

您可以使用大纲视图跳转到方法。大纲视图显示当前打开的源文件的所有方法、字段和内部类(及其方法、字段和内部类...等)。我个人更喜欢这种方法,除非我有堆栈跟踪并且知道我想跳转到哪一行,在这种情况下我使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文