如何在 Eclipse IDE 中拆分和取消拆分窗口/视图?

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

How do you split and unsplit a window/view in Eclipse IDE?

eclipseide

提问by Xonatron

How do you split a window/view in Eclipse IDE? I want to edit code while viewing the different code in the same file.

如何在 Eclipse IDE 中拆分窗口/视图?我想在查看同一文件中的不同代码时编辑代码。

If there is a trick to open the same file twice, this might do, but I would rather just split the one current view instead of having two of the same which might get confusing.

如果有一个技巧可以两次打开同一个文件,这可能会,但我宁愿只拆分一个当前视图,而不是有两个相同的视图,这可能会让人感到困惑。

回答by VonC

This is possible with the menu items Window>Editor>Toggle Split Editor.

这可以通过菜单项Window>Editor>Toggle Split Editor 实现

Current shortcut for splitting is:

当前拆分的快捷方式是:

Azerty keyboard:

Azerty 键盘

  • Ctrl+ _for split horizontally, and
  • Ctrl+ {for split vertically.
  • Ctrl+_用于水平分割,以及
  • Ctrl+{用于垂直拆分

Qwerty US keyboard:

Qwerty 美式键盘

  • Ctrl+ Shift+ -(accessing _) for split horizontally, and
  • Ctrl+ Shift+ [(accessing {) for split vertically.
  • Ctrl+ Shift+ -(访问_)用于水平分割,以及
  • Ctrl+ Shift+ [(访问{),用于拆分垂直

MacOS - Qwerty US keyboard:

MacOS - Qwerty 美国键盘:

  • ?+ Shift+ -(accessing _) for split horizontally, and
  • ?+ Shift+ [(accessing {) for split vertically.
  • ?+ Shift+ -(访问_)用于水平分割,以及
  • ?+ Shift+ [(访问{),用于拆分垂直

On any other keyboard if a required key is unavailable (like {on a german Qwertz keyboard), the following generic approach may work:

在任何其他键盘上,如果所需的键不可用(例如{在德国 Qwertz 键盘上),以下通用方法可能有效:

  • Alt+ ASCII code + Ctrlthen release Alt
  • Alt+ ASCII 码 +Ctrl然后释放Alt

Example: ASCII for '{' = 123, so press 'Alt', '1', '2', '3', 'Ctrl' and release 'Alt', effectively typing '{' while 'Ctrl' is pressed, to split vertically.

示例:ASCII 为 '{' = 123,因此按 'Alt'、'1'、'2'、'3'、'Ctrl' 并释放 'Alt',在按下 'Ctrl' 的同时有效键入 '{',垂直分割

Example of vertical split:

垂直拆分示例:

https://bugs.eclipse.org/bugs/attachment.cgi?id=238285

https://bugs.eclipse.org/bugs/attachment.cgi?id=238285

PS:

PS:

  • The menu items Window>Editor>Toggle Split Editorwere added with Eclipse Luna 4.4 M4, as mentioned by Lars Vogel in "Split editor implemented in Eclipse M4 Luna"
  • The split editor is one of the oldest and most upvoted Eclipse bug! Bug 8009
  • The split editor functionality has been developed in Bug 378298, and will be available as of Eclipse Luna M4. The Note & Newsworthy of Eclipse Luna M4 will contain the announcement.
  • 菜单项窗口>编辑>切换拆分编辑器中使用Eclipse月神添加4.4 M4,如“提到的拉尔斯·沃格尔在Eclipse M4月神拆分编辑器中实现
  • 拆分编辑器是最古老和最受好评的 Eclipse 错误之一!错误 8009
  • 拆分编辑器功能已在错误 378298 中开发,并将从 Eclipse Luna M4 开始提供。Eclipse Luna M4 的注释和新闻价值将包含该公告。

回答by DerMike

You can open a new editorfrom the Window menu.

您可以从“窗口”菜单中打开一个新编辑器

This will give you your current editor once again.

这将再次为您提供当前的编辑器。

回答by Michael Morgan

If you right click on one of the tabs, one of the options should be New Editor(for me, it's at the bottom). Select that, and then drag the new tab onto the bottom scroll bar of the code editor, which will split the editor panel in two.

如果您右键单击其中一个选项卡,其中一个选项应该是New Editor(对我来说,它在底部)。选择它,然后将新选项卡拖到代码编辑器的底部滚动条上,这会将编辑器面板一分为二。

回答by asok Buzz

Just click and drag editor title to left, right, top or bottom

只需单击并将编辑器标题拖动到左侧、右侧、顶部或底部

回答by Stephen W. Wright

Side by side editors in single Eclipse window.

单个 Eclipse 窗口中的并排编辑器。

  1. You have an Eclipse window showing a single editor.
  2. Window -> new editor. You now have two editor tabs.
  3. Click and drag one tab towards the right and a green outline of a vertical screen appears (drag tag towards the bottom and an outline of a horizontal screen outline appears). You can let go as soon as the outline appears.
  4. Open file of choice in 2nd editor (recent files show up at bottom of file menu).
  1. 您有一个显示单个编辑器的 Eclipse 窗口。
  2. 窗口 -> 新编辑器。您现在有两个编辑器选项卡。
  3. 单击并向右拖动一个选项卡,出现垂直屏幕的绿色轮廓(向下拖动标签,出现水平屏幕轮廓的轮廓)。轮廓一出现就可以放手了。
  4. 在第二个编辑器中打开选择的文件(最近的文件显示在文件菜单的底部)。

ADT/Eclipse:Build: v22.3.0-887826

ADT/Eclipse:Build: v22.3.0-887826

回答by Ahmed Osman

I tried the above solutions in Eclipse Luna 4.4.1 but couldn't open two (or multiple editor windows for different files side by side).

我在 Eclipse Luna 4.4.1 中尝试了上述解决方案,但无法同时打开两个(或多个不同文件的编辑器窗口)。

Simplest Solution:

最简单的解决方案:

  1. Open all files you want in a single window.
  2. Drag the tabof each of the files to right or to the left, eclipse will automatically display a split screen display and will split the editor into two windows once you leave the mouse button.
  3. repeat for each file/tab.
  1. 在一个窗口中打开您想要的所有文件。
  2. 将每个文件的选项卡向右或向左拖动,eclipse 将自动显示分屏显示,一旦您离开鼠标按钮,就会将编辑器分成两个窗口。
  3. 对每个文件/标签重复。

Happy Coding!

快乐编码!

回答by akikhtenko

You might want to check an eclipse plugin called HandySplit

您可能想检查一个名为HandySplit的 Eclipse 插件

It allows to split an editor into two and move tabs from one editors stack to another with keyboard shortcuts only.

它允许将一个编辑器一分为二,并且使用键盘快捷键将选项卡从一个编辑器堆栈移动到另一个编辑器堆栈。

That works on Eclipse Juno or higher. For the previous Eclipse versions check thisout

这适用于 Eclipse Juno 或更高版本。对于以前的Eclipse版本检查

回答by Allan

Simply go to Window > New Window

只需转到“窗口”>“新窗口”

This will open up a new window of the same Workspace in eclipse.

这将在 eclipse 中打开同一工作区的新窗口。

You can open up separate files in each Window.

您可以在每个窗口中打开单独的文件。

回答by mnc

Below are the steps to spliteditor horizontally or vertically go to:

以下是split水平或垂直编辑的步骤:

Window -> Editor -> Toggle Split Editor (Horizontal) 

to split editor horizontally or

水平拆分编辑器或

Window -> Editor -> Toggle Split Editor (vertical) 

to split editor vertically.

垂直拆分编辑器。

It will open two editors side by side or will pileup tow.

它会并排打开两个编辑器或会堆积在一起。

回答by auspicious99

On Mac OS, the key combination to toggle spit/unsplit for horizontal split is ? ? - ("cmd"+"shift"+"-"), whereas for vertical split, it is ? ? [ ("cmd"+"shift"+"[")

在 Mac OS 上,切换水平拆分的吐出/取消拆分的组合键是 ? ? - ("cmd"+"shift"+"-"),而对于垂直拆分,它是 ? ? [ ("cmd"+"shift"+"[")