在 Eclipse 中终止调试过程后如何改回视角?

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

How to change back the perspective after terminating the debugged process in Eclipse?

eclipse

提问by helifreak

Eclipse by default automatically switches to the Debug perspective when you hit a breakpoint.

默认情况下,当您遇到断点时,Eclipse 会自动切换到 Debug 透视图。

However, it is annoying me that it doesn't automatically switch back to the previous perspective (say, Java) when terminating the process.

然而,让我烦恼的是它在终止进程时不会自动切换回之前的视角(比如 Java)。

It just stays in the debug perspective even though there is nothing to debug because nothing is running.

它只是停留在调试视角,即使没有任何东西可以调试,因为没有任何东西在运行。

回答by VonC

To complete mark's answer, that option tells Eclipse when to switch to the associated perspective upon program suspension - meaning when a breakpoint is hit, it will switch to Debug perspective.

为了完成 mark 的回答,该选项告诉 Eclipse 何时在程序暂停时切换到关联的透视图 - 这意味着当遇到断点时,它将切换到 Debug 透视图。

Switching back to another perspective after you're done debugging has to be:

完成调试后切换回另一个角度必须是:

Debug Perspective Auto Closer

Automatically opens previous perspective when debugging ends.

Behaviors: (configurable: Preferences -> Debug Perspective Auto Closer)

  1. [default] when all debug launches have terminated, changes to perspective active on first launch
  2. when any debug launch has terminated, changes to perspective active on that launch

调试视角自动关闭器

调试结束时自动打开以前的透视图。

行为:(配置:Preferences -> Debug Perspective Auto Closer

  1. [默认] 当所有调试启动都终止时,在第一次启动时更改为激活的透视图
  2. 当任何调试启动终止时,更改为该启动时激活的透视图

Java perspective

Java视角

If you want to avoid it switching to Debug in the first place, you can choose "Never" as the option (introduced in Eclipse 3.2 at the time).

如果您想避免它首先切换到调试,您可以选择“从不”作为选项(当时在 Eclipse 3.2 中引入)。

(You can find the given Preferencespage in Run/Debug > Perspective)

(您可以在 中找到给定Preferences页面Run/Debug > Perspective

alt text

替代文字

If you want to switch back in the situation where the debugged program terminates normally (Not when youwant to stop debugging it yourself), you may hope Eclipse figures out that your program terminates normally and switch to a "default" perspective at that time...

如果您想在被调试程序正常终止的情况下切换回来(不是在想自己停止调试时),您可能希望 Eclipse 确定您的程序正常终止并在那时切换到“默认”透视图。 ..

However, there is no notion of "default" perspective, so how would Eclipse knows which one to switch to ? (the "Preferences/Perspectives/Make default" is only for the "Open Perspective" dialog, but that may not be the same perspective than the one you actually want to switch back to after a debug)

但是,没有“默认”透视图的概念,那么 Eclipse 怎么知道要切换到哪个透视图呢?(“首选项/透视图/设为默认值”仅适用于“打开透视图”对话框,但这可能与您在调试后实际想要切换回的透视图不同)

Open perspective

开阔视野

Also, should Eclipse closes the Debug perspective or just changes to a different one ?
What if there is more than one program running -- when one terminates, you might still be interested in debugging the other one, or maybe not.

另外,Eclipse 应该关闭 Debug 透视图还是只是更改为不同的透视图?
如果有多个程序在运行 - 当一个程序终止时,您可能仍然有兴趣调试另一个程序,或者可能没有。

The point is, the decision about whento change perspective (and whatperspective to change to) is not reasonable for the machine to make -- it requires a person knowing what he wants to do next.

关键是,关于何时改变视角(以及改变到什么视角)的决定对于机器来说是不合理的——它需要一个人知道他接下来想要做什么。

回答by Bishop

回答by IAdapter

you would need to write eclipse plugin

你需要编写eclipse插件

herei found example how in plugin switch perspective

在这里我找到了示例如何在插件切换视角

回答by Name is carl

As of 2015, this very basix UI woe is not addressed in Eclipse: the official bug reportis assigned (but not fixed).

截至 2015 年,Eclipse 中未解决这个非常基础的 UI 问题:已分配(但未修复)官方错误报告

Fortunately, Sven Ramuschkat and Dirk Eismannwrote a plugin for that: the Perspective Switcher Plugin for Eclipse / Flash Builder

幸运的是,Sven Ramuschkat 和 Dirk Eismann为此编写了一个插件:Eclipse / Flash Builder透视切换器插件

the Plugin will now automatically switch back from a Debug perspective to the previous non-Debug perspective as soon as the Debug session is terminated

一旦调试会话终止,插件现在将自动从调试视角切换回以前的非调试视角

It works on Eclipse Luna (and above)

它适用于 Eclipse Luna(及更高版本)

Installation

安装

Download the zip file, uncompress and copy the jar file in your eclipse/pluginsfolder.

下载zip 文件,解压并将 jar 文件复制到您的eclipse/plugins文件夹中。

Once it's done, you will see a new Preferencepane.

完成后,您将看到一个新Preference窗格。

pref

首选项

Everything is configured for Eclipse to switch back to Javaperspective if you have a javaor propertiesfile opened when the debugging session ends.

Java如果您在调试会话结束时打开了javaproperties文件,则所有内容都已配置为 Eclipse 切换回透视图。

回答by Name is carl

I do not think it's possible to have eclipse switch back automatically but you can do it with the click of a button in the top-right of your window

我不认为有可能让 Eclipse 自动切换回来,但您可以通过单击窗口右上角的按钮来实现

enter image description here

在此处输入图片说明