70

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

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

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

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
helifreak
  • 1,303
  • 2
  • 11
  • 16

6 Answers6

28

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.

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

Java perspective

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).

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

alt text

If you want to switch back in the situation where the debugged program terminates normally (Not when you want 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...

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)

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.

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

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 36
    I agree with everything but "is not reasonable for the machine to make ". Visual Studio does a fine job by returning to the main view when there are no processes left to debug. – Joe Ludwig Feb 07 '09 at 02:51
  • 1
    @Joe Ludwig: agreed. Eclipse may be victim of its own complexity, tricking itself into *not* offering this feature. – VonC Feb 07 '09 at 11:47
  • @Joe Ludwig: btw, sorry: I did not play at Pirate: I am not so much into MMO... Right now, I play GTAIV (solo) ;) – VonC Feb 07 '09 at 11:50
  • 11
    I think the appropriate solution would be to switch back to the previous perspective that I was in before the debug perspective, if all debug sessions have ended. As Joe mentioned, Visual Studio, and all other IDEs i've used do this by default. – helifreak Feb 09 '09 at 23:57
  • 3
    Amazing answer, +1. But... do you care to elaborate a bit on "mark's answer"? I think he may have deleted his answer.. was there any relevant info there that you didn't cover? – MestreLion Apr 14 '12 at 01:31
  • @MestreLion No, Mark hasn't deleted his answer. He has changed his name though to IAdapter. Who might have refered to a thread similar to http://www.eclipse.org/forums/index.php/m/337020/?srch=plugin+switch+perspective#msg_337020. Note: I have restore the missing picture in my answer. – VonC Apr 14 '12 at 09:19
  • @VonC: could you please specify that you can find the given *Preferences* page in `Run/Debug > Perspective` ? It can be confused with the `General > Perspective` view otherwise. thx U_U CORRIGE: Uh.. I me myself can edit answers actually ! XD – Campa Jul 17 '15 at 14:32
  • 1
    @Campa good point. I have included your comment in the answer for more visibility. – VonC Jul 17 '15 at 14:34
23

Ctrl + F8, the default shortcut to change views, reduces the pain a bit.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
9

I filed a bug for this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=327983

Bishop
  • 91
  • 1
  • 2
  • 2
    Duplicate of the 9-years-old bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=46336 , although I think yours is better, more generic, and not tied to Java view – MestreLion Apr 14 '12 at 01:34
  • What we can do is vote for https://bugs.eclipse.org/bugs/show_bug.cgi?id=46336 , maybe this will make them really do something about this bug. – user626528 Sep 24 '18 at 22:19
4

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

enter image description here

3

you would need to write eclipse plugin

here i found example how in plugin switch perspective

IAdapter
  • 62,595
  • 73
  • 179
  • 242
2

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

Fortunately, Sven Ramuschkat and Dirk Eismann wrote a plugin for that: the Perspective Switcher Plugin for 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)

Installation

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

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

pref

Everything is configured for Eclipse to switch back to Java perspective if you have a java or properties file opened when the debugging session ends.

Name is carl
  • 5,961
  • 3
  • 29
  • 44
  • Didn't work for me. I use the `Java EE` prespective. After debug it switches to `Java` prespective and not `Java EE`. Also, with the plugin enabled I cannot even manually switch to `Java EE` as it changes it back to `Java` event when not debugging (Luna 4.4.2). – Odys Jan 22 '16 at 17:19