Java 如何回到 Eclipse 中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3095318/
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-08-13 16:25:18  来源:igfitidea点击:

How to go back in Eclipse?

javaeclipse

提问by froadie

Is there a way to go back in Eclipse? Basically, when I'm jumping around a big project following the execution flow (ctrl + click and etc.), is there a way to retrace a step? If my code calls a method and I go to the method definition, is there a key combination that will take me back to the calling code?

有没有办法回到 Eclipse 中?基本上,当我按照执行流程(ctrl + 单击等)跳过一个大项目时,有没有办法回溯步骤?如果我的代码调用一个方法并且我转到方法定义,是否有一个组合键可以将我带回调用代码?

采纳答案by lucas

Press Alt+Left Arrowand Alt+Right Arrowlike you would in a web browser.

像在 Web 浏览器中一样按Alt+Left ArrowAlt+ Right Arrow

回答by Robin

In addition to the keyboard shortcut mentioned by @lucas, there is the left and right arrow icons in the toolbar. It also has a handy back to last edit location as well.

除了@lucas 提到的键盘快捷键,工具栏中还有左右箭头图标。它还有一个方便的返回到上次编辑位置的功能。

Both of these are of course reflected in the menu under Navigate as well.

这两者当然也反映在导航下的菜单中。

回答by EMurnane

As Robin mentioned, you can also jump to the last edit location. Ctrl+Q is the keyboard shortcut for this!

正如 Robin 所提到的,您还可以跳转到最后一个编辑位置。Ctrl+Q 是这个的键盘快捷键!

回答by vaichidrewar

On OS X:

在 OS X 上:

  • ?+ [( Command + [ ) : Go Back
  • ?+ ]( Command + ] ) : Go Forward
  • ?+ [( 命令 + [ ) : 返回
  • ?+ ]( 命令 + ] ) : 前进

回答by stevebot

On Windows/Ubuntu this was always

在 Windows/Ubuntu 上,这总是

ALT+LEFT ARROW = Go back

ALT+LEFT ARROW = Go back

ALT+RIGHT ARROW = Go forward

ALT+RIGHT ARROW = Go forward

However, on MAC OSX, for me it was

然而,在 MAC OSX 上,对我来说是

ALT(Option)+COMMAND+LEFT ARROW = Go back

ALT(Option)+COMMAND+LEFT ARROW = Go back

ALT(Option)+COMMAND+RIGHT ARROW = Go forward

ALT(Option)+COMMAND+RIGHT ARROW = Go forward

Hopefully this will help other Mac people in the future who banged their head on the desk when the other answers did not work.

希望这将有助于将来在其他答案不起作用时将头撞在桌子上的其他 Mac 人。

回答by chris544

These commands are very frequently used, so it is worth having all their shortcuts the same way in all your IDEs. To adjust them:

这些命令非常常用,因此值得在所有 IDE 中以相同的方式使用它们的所有快捷方式。要调整它们:

  1. Open Eclipse
  2. Windows -> Preferences -> General -> Keys
  3. Search for "Backward History" and "Forward History" and adjust the bindings.
  1. 打开日食
  2. Windows -> 首选项 -> 常规 -> 键
  3. 搜索“Backward History”和“Forward History”并调整绑定。

For me personally Visual Studio's default Ctrl+- and Ctrl+= works best.

就我个人而言,Visual Studio 的默认 Ctrl+- 和 Ctrl+= 效果最佳。

回答by studgeek

Keyboard bindings can change based on your OS and current Keys Scheme. So the best way to know a keyboard binding is to look up its Command in Preferences > Keys. That is also where you can change or add a keyboard binding.

键盘绑定可以根据您的操作系统和当前的按键方案进行更改。因此,了解键盘绑定的最佳方法是在首选项 > 键中查找其命令。这也是您可以更改或添加键盘绑定的地方。

Which means instead of asking for a shortcut, you should generally ask for the command (or at least ask for both). In this case the commands you want are Backward Historyand Forward History. You can see in the following screenshot that they are mapped to Ctrl+[and Ctrl+]in my Key Scheme (because I changed them to that).

这意味着您通常应该要求命令而不是要求快捷方式(或至少要求两者)。在这种情况下,您想要的命令是Backward HistoryForward History。您可以在以下屏幕截图中看到它们在我的密钥方案中映射到Ctrl+[Ctrl+ ](因为我将它们更改为那个)。

enter image description here

在此处输入图片说明

As mentioned by others, Last Edit Locationcan be a really useful command also. In my case it's mapped to Ctrl+Q, but you check it under Keys :).

正如其他人所提到的,Last Edit Location它也是一个非常有用的命令。在我的情况下,它映射到Ctrl+ Q,但您在 Keys 下检查它:)。