Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to force Eclipse to open in the default perspective?

Tags:

eclipse

Problem:

Whenever I start Eclipse (3.5.2 Galileo) it always opens in the previous perspective I was using. I want it to ALWAYS open in the default perspective, but I can't find a way of setting that in the preferences.

Background (i.e. why this is important to me - LONG!):

I use a laptop for dev work for which I have a docking station at my desk. When I'm docked, I have two monitors giving me 2400 horizontal pixels of real estate and I work in a perspective that has a full-size code editing screen on one monitor and all other views (console, package explorer, JUnit, etc.) open in floating windows on the other monitor.

When I undock and use the built in screen on the laptop, I "only" have 1920 pixels horizontally. If I open my "2-screen" perspective in this situation, the floating windows are dragged left so that their right-hand edges align with the screen, and they overlap each other and the main coding window. What's worse is that if I exit Eclipse or switch to my 1-screen perspective (which I've set as the default), the current layout of the 2-screen perspective is saved and so I have to drag all the windows back to where they belong when I get back to my docking station.

I try to remember to switch to the 1-screen perspective before I close Eclipse each time, especially if I know I'll be working undocked next time I open Eclipse, but I forget more often than I remember, sadly.

Therefore, I'd like to have Eclipse always open in the default, 1-screen Java perspective. If I'm undocked, that's the perspective I'll use. If I'm docked, I can switch to the 2-screen quickly using one icon in the toolbar.

Any suggestions?

like image 914
Rob Gilliam Avatar asked Dec 15 '10 09:12

Rob Gilliam


1 Answers

There is no setting in the preferences dialog to do that. However, as a hack you can find the last perspective attribute stored in the file: workspace/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml. It's an XML file, and the attribute you want to freeze is: <perspectives activePerspective="...">.

You can use a simple script to alter that setting before running Eclipse.

like image 138
vz0 Avatar answered Nov 14 '22 05:11

vz0