Eclipse reverts perspective on startup - eclipse

Every time I start up Eclipse (Juno SR2), it reverts to the Java EE perspective, regardless of what perspective I was using before. When I add and switch back the the Java perspective, it has also reset all my windows (Search, JUnit etc.), and all my opened files has been closed as well.
We are a few people here who experience the same problems. Does anyone know how to prevent it?

Try setting up your perspective and configure it as you want it, and then select Window > Save Perspective As... Give the perspective a name and press OK.
Then go to Window > Preferences > General > Perspectives
Find your newly saved perspective in the list, select it and then press Make Default.

Related

Ecplise IDE: Is there a way to automatically switch back in perspectives? [duplicate]

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.
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:
manual (mouse click)
manual ("Switch Perspective" shortcut CTRL F8)
automatic: Debug Perspective Auto Closer, which supplements bug 46336. (initially reported by zim)
Debug Perspective Auto Closer
Automatically opens previous perspective when debugging ends.
Behaviors: (configurable: Preferences -> Debug Perspective Auto Closer)
[default] when all debug launches have terminated, changes to perspective active on first launch
when any debug launch has terminated, changes to perspective active on that launch
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)
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)
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.
Ctrl + F8, the default shortcut to change views, reduces the pain a bit.
I filed a bug for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327983
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
you would need to write eclipse plugin
here i found example how in plugin switch perspective
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.
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.

Eclipse Juno Perspective tool bar

While dragging the perspective tool bar to a different place in eclipse Juno, my eclipse got hang, and after restarting eclipse, the perspective bar gone.
I tried googling but didnt find a solution to display that bar again. Anyone got a solution?
There is actually no need to reset your perspective, let alone to nuke your workbench.xmi memo file. There is a smarter way:
Open a new workbench window. From the main menu: Window => Ǹew Window. Please note that the new window does have the (already customized) Perspective Bar.
Close the window that does not have the Perspective Bar first.
Close the second window. This will save a cleaner version of workbench.xmi (overriding the one that has a perspective bar positioned out of the screen).
Reopen eclipse. The Perspective Bar is back at its place.
There are two things you can try:
Reset your current perspective (Window/Reset perspective...). Although your configured set of views will get lost, it might bring back the perspective switcher.
If that does not work, then you should reset the entire saved workbench GUI. This can be done by deleting the .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi file from your workspace folder, or by starting eclipse with the -clearPersistedState
Point 2. assumes, that in case of Juno you are using Eclipse 4.2 (the new GUI, not 3.8, the old).
First of all let me say: I will quit of using Eclipse as soon as putting perspective menu to left will be impossible (and force my team to do so as well).
As workaround I do the following for every new workspace
Create workspace
Close eclipse
Override .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi by stashed file.
I made stashed workbench.xmi this way:
Create workspace in 3.8, configure bar at left
Open this workspace in 4.* (it will create stashed file).
Close eclipse
Stash workbench.xmi.
At least on eclipse 2019-06 (4.12.0), it's enough to
"switch workspace"->"Other"->"Recent Workspaces"->(The same you're on)

How to arrange windows in Eclipse back into default state?

Is there a function that would arrange windows in Eclipse into state that was previously saved?
I always resize windows (Package Explorer, panels with views etc.) based on current needs and then I have to put it back.
Maximizing and minimizing is great but this would be really a killer feature. A click to arrange windows to the desired state would be perfect
You can save your Perspective how you like it and then when that Perspective gets loaded it will come back to the saved state:
Window > Save Perspective As...
To reset:
Window > Reset Perspective...
Click on windows > Perspective > Reset Perspective
Open new window it will set a default view for eclipse
window->new window

Eclipse: How do I refresh an entire workspace? F5 doesn't do it

I have a workspace with a bunch of java projects. If I go to File->Refresh, it doesn't really refresh anything (perhaps the currently selected project). How do I get eclipse to refresh all of the projects?
It will indeed only refresh the current project (or, more specifically, the current selection in the project explorer). I just click somewhere in the project explorer, do Ctrl+A to select all projects and then press F5 to achieve a complete refresh.
If you want to refresh all Projects, ignoring closed projects, then the easiest way is to:
ctrl-click and item in the Project Explorer (to ensure the P. Explorer has focus)
ctrl-click the item again so that it's no longer highlighted (but the P. Explorer still has focus)
F5 will now Refresh the entire workspace
Effectively F5 refreshes the Workspace when a navigation view has focus and nothing is selected.
Ctrl-A, then F5.
You can set up the workspace to automatically refresh when it detects changes in the preferences. (Window > Preferences > General > Workspace > Refresh Automatically)
Easy.
Create an external tool: Run > External Tools > External Tools
Configuration...
Create a new Program configuration Point the location to an exe that is very fast (I use Cygwin's 'ls')
On the Refresh tab, choose Refresh Resources upon completion, The Entire Workspace
On the Build tab, deselect Build before launch
Run the tool to refresh all projects.
Control click all your projects together, then right click and hit refresh.
Usually I refresh all like that, then i make sure to clean all projects and rebuild in eclipse.
For anyone curious how to select all of those projects on OS X where Ctrl+A doesn't work:
Click the first project
Hold down Shift
Hold the ↓ key until they are all selected
Now press F5
This answer led me to an even simpler solution, no configuration necessary.
Cmd-3 build all (control-3 on windows)
Edit: Correction -- I need to both refresh and build. Build does not automatically refresh. I'm currently using two actions, "echo" from my comment in the linked answer I just referred to (an External Tool configuration with a hook to refresh all), followed by cmd-3 "build all"

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

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.
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:
manual (mouse click)
manual ("Switch Perspective" shortcut CTRL F8)
automatic: Debug Perspective Auto Closer, which supplements bug 46336. (initially reported by zim)
Debug Perspective Auto Closer
Automatically opens previous perspective when debugging ends.
Behaviors: (configurable: Preferences -> Debug Perspective Auto Closer)
[default] when all debug launches have terminated, changes to perspective active on first launch
when any debug launch has terminated, changes to perspective active on that launch
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)
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)
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.
Ctrl + F8, the default shortcut to change views, reduces the pain a bit.
I filed a bug for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327983
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
you would need to write eclipse plugin
here i found example how in plugin switch perspective
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.
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.