Bug 11757 - [Perspectives] Closing windows causes loss of all unsaved perspective customization
Summary: [Perspectives] Closing windows causes loss of all unsaved perspective customi...
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P5 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 6752 352206 457510 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-03-19 22:57 EST by Cagatay Kavukcuoglu CLA
Modified: 2015-01-15 22:40 EST (History)
5 users (show)

See Also:


Attachments
code changes (43.80 KB, application/octet-stream)
2002-11-05 15:07 EST, Lynne Kues CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cagatay Kavukcuoglu CLA 2002-03-19 22:57:25 EST
From the newsgroup posting "Re: Working sets and multiple windows( was:Navigator
view)":

"...I saw that the proposal is for working sets to replace workbench page
inputs. I'm waiting impatiently for that one, not being able to use working sets
for page inputs is one the two reasons I don't like opening multiple windows in
Eclipse.

"The other one is that if you close a window, you lose all your perspective
customizations unless you saved them first. I do this a lot, especially when I
want to exit Eclipse but close the active window instead of using File > Exit.
Autosaving perspectives seems like a solution, but I suspect it has its own set
of problems. Are there any plans to make this better?

"Failing that, I'd want the option to not share editors between perspectives in
a window, I think bug 11001 requests this feature."
Comment 1 Kevin Haaland CLA 2002-05-01 18:50:36 EDT
This would be a great enhancement. Any chance you can implement this for us 
Cagatay?
Comment 2 Cagatay Kavukcuoglu CLA 2002-05-02 00:21:30 EDT
Which one, automatically saving dirty perspectives or not sharing editors 
between perspectives?

I was already planning a patch to improve editor management, it's on top of my 
list of things to do.

I'm not quite sure what the best UI for auto-saving perspectives is. If the 
problem is losing perspective layout when closing workbench windows, maybe a 
quick-and-dirty solution is to give an option to restore the most recently 
closed window (or keep a MRU list of closed windows). On second thought, this 
seems a good solution, not just a quick-and-dirty one.

I've grown to like saving perspectives in the meantime, and it seems a step 
back to just auto-save them every time they change in any window. I think it's 
better to keep saved perspectives under user control.
Comment 3 Kevin Haaland CLA 2002-05-02 10:34:48 EDT
New users do complain about the current behavior. Once they become proficient 
(like yourself) they often stop complaining but the initial behavior is 
suprising. It is also very subtle the situations in which the user needs to 
overwrite the existing perspective or define a new one. 

What I would like to see is that perspective chagens do not require an explicit 
save perspective and the reset action restores the perspective to it's original 
state.

I am not a fan of the "do not share editors between perspectives" option.  
Comment 4 Lynne Kues CLA 2002-10-07 17:58:39 EDT
Kevin,

When you say Reset Perspective restores the perspective to its "original" 
state, do you mean the initial default state?  For example:

1) Open perspective A.
2) Change layout of perspective A.
3) Close perspective A (layout automatically saved for you as requested by bug 
report).
4) Open perspective A (layout as it was in Step 2).
5) Change layout of perspective A.
6) Reset Perspective A.

Should the perspective be reset to the layout in Step 1 or the layout in Step 2?
Comment 5 Lynne Kues CLA 2002-10-09 10:34:18 EDT
From KH:

Step 1. 

If perspective changes are eagerly persisted then the only other choice for the 
reset in step 6 
would be to restore the perspective to the state saved in step 5 which does not 
seem to add
much value. (ie. this behavior for reset perspective is useless?)

If you are working on perspective enhancements can you also make sure that the 
perspective
changes are persisted in preference files. This is required for the 
import/export of preferences 
to work. 
Comment 6 Lynne Kues CLA 2002-10-09 17:29:48 EDT
Kevin, one more clarification.  In the Save Perspective As... scenario, I 
assume you would want Reset Perspective to work as follows:

1. Open Perspective A.
2. Change layout of Perspective A.
3. Save Perspective A as Perspective B.
4. Change layout of Perspective B.
5. Reset Perspective B.  ==> Changed to the layout in Step 3.
Comment 7 Lynne Kues CLA 2002-10-10 14:48:37 EDT
On above, yes from KH - reset to layout in Step 3.  Also need to consider New 
Window.  This should open the new perspective as it is, not as it's default.
Comment 8 Lynne Kues CLA 2002-10-23 15:05:28 EDT
Opened [Bug 25270] [Perspectives] Saving perspective layout via export 
preferences for save layout as preference data request.
Comment 9 Lynne Kues CLA 2002-11-05 14:48:14 EST
Instead of saving on every layout change, which is a complex solution, 
investigated automatically saving the layout when a perspective is closed.  

Changed code to automatically save the perspective layout whenever a 
perspective is closed or when a New Window is closed (i.e., all perspectives on 
the new window will have their layouts saved).  The last saved layout wins in 
the case where multiple instances of the same perspective exist (e.g., when you 
have more than one workbench window opened).  

In the user-defined case, I needed to save the "original" layout in order to 
handle the Reset Perspective case as KH indicated above.  When you "Save 
Perspective As" (and you are not overwriting an existing perspective) the 
original layout will be set to the layout as it is (i.e., as it is when the 
Save Perspective As is executed) and when one says "Reset Perspective", this 
original layout will be restored.  

For user-defined layouts that exist in old workspaces, the layout that exists 
upon load (i.e., starting of workspace) will become the original layout for the 
perspective.

Approach generally works and was straightforward to implement, but feedback was 
that automatically saving perspective layouts in the the multiple window case 
is confusing since you could have two completely different layouts for the same 
perspective.  It was decided that the explicit "Save As..." capability is more 
explicit, so marking this as WONTFIX.

Related to this report is whether or not New Window should clone the layout of 
the active perspective (currently the action opens a New Window with the 
current perspective in it's default.original layout).  Will open a separate bug 
report for this.


Comment 10 Lynne Kues CLA 2002-11-05 14:49:35 EST
Some additional notes from NE on the save immediately approach:

Actually, it was the crash scenario I had in mind when I suggested saving 
immediately.  However, I've come across another while trying out the patch:

1. change resource perspective (I opened the Properties view as a regular view, 
and the CVS Repositories view as a fast view, and changed some of the pane 
sizes)
2. Window / New Window
3. the new window does not have the changes

If you close and reopen the perspective after 1, it works.

Also, "The last saved layout wins in the case where multiple instances of the 
same perspective exist " results in an indeterminate order.  If you save right 
away, then the order is predictable and reasonable: it saves the last change 
the user made.

We could change it to save the current perspective when you choose Window / New 
Window.  However, since we allow windows and perspectives to be opened 
programmatically, in general we have no way of ensuring that any current 
perspective state is saved before opening a new one.  The safest thing to do 
would be to save immediately.

Saving automatically (regardless of when we do the save) seems to be pretty 
confusing if you have multiple windows with the same perspectives.  I may 
choose to arrange them completely differently, but only one arrangement gets 
persisted.  If I open another one, which layout do I get?
Comment 11 Lynne Kues CLA 2002-11-05 14:54:14 EST
Opened [Bug 25742] for New Window behavior.
Comment 12 Lynne Kues CLA 2002-11-05 15:07:14 EST
Created attachment 2315 [details]
code changes

Code for changes that were investigated.  Code roughly based on 20021105 build
of org.eclipse.ui.workbench.
Comment 13 Sebastian Davids CLA 2003-04-10 10:55:56 EDT
*** Bug 6752 has been marked as a duplicate of this bug. ***
Comment 14 Sebastian Davids CLA 2003-04-10 11:00:12 EDT
see Bug 9974 [Perspectives] Perspective customization : (save customize actionset)
Comment 15 Sebastian Davids CLA 2003-04-10 11:08:59 EDT
Why not make this a preference?

I think the common user (w/ one monitor) has just one Eclipse Window open ... so
the "perceived" problem does not happen to them ... rather they loose their
perspective setup.
Comment 16 Simon Arsenault CLA 2003-05-02 14:00:44 EDT
*** Bug 6752 has been marked as a duplicate of this bug. ***
Comment 17 Randy Hudson CLA 2005-05-06 13:39:36 EDT
Multiple instances are not unique to the perspective problem. Every single view
in Eclipse can exist multiple times, yet the preference changes made are
immediately persisted and used the next time the view is (re)created. For example:

- The split pane orientation in the variables view
- Filters in the Package Explorer
- Sorting/Filters in the Problems View
- Synchronize settings (Need to open a bug, they only save lazily when the view
is closed)

> If I open another one, which layout do I get?

The same question is valid for Views (replace "layout" with filter, sort order,
visibilty of static fields, etc. etc.), so why is the answer different here?

See also bug 9974
Comment 18 Paul Webster CLA 2006-09-28 10:58:34 EDT
There are currently no plans to work on this feature.

PW
Comment 19 Denis Roy CLA 2007-06-22 09:32:28 EDT
Changes requested on bug 193523
Comment 20 Paul Webster CLA 2011-07-18 07:18:36 EDT
*** Bug 352206 has been marked as a duplicate of this bug. ***
Comment 21 Wojciech Sudol CLA 2015-01-15 11:27:34 EST
*** Bug 457510 has been marked as a duplicate of this bug. ***
Comment 22 Paul Verest CLA 2015-01-15 22:40:28 EST
I guess before too many things were discussion, nothing was done.

from 
Bug 457510 - [New Window] After starting second IDE window and closing the first all perspective customizations are lost

Please add warning when closing the second Window and the first is still open.

Or better warn and suggest to close nicely like

"Closing window after other windows were opened will reset perspective to last closed Window"

[Cancel] [Exist and keep customization] [Close this window]

So just dialog on closing would help.