Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337593

Summary: [Workbench] Workbench windows' layout should be persisted for every change (sash resizes, detaching/attaching of views, moving views)
Product: [Eclipse Project] Platform Reporter: Aaron Digulla <digulla>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED DUPLICATE QA Contact: Paul Webster <pwebster>
Severity: enhancement    
Priority: P3 CC: bugs, daniel_megert, john.arthorne, prakash, remy.suen, Szymon.Brandys
Version: 3.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Save UI State plugin [3.3 - 4.0) none

Description Aaron Digulla CLA 2011-02-18 12:11:49 EST
Build Identifier: 

Setting the "Workspace save interval" to any value has no effect; if Eclipse crashes, the workspace is restored to the state it had when it was closed the last time.

A workaround is to get the source code for the saveuistate plugin from http://eclipsenuggets.blogspot.com/2007/09/how-to-save-eclipse-ui-workbench-state_6644.html and change the line in the MANIFEST.MF to:

 org.eclipse.ui;bundle-version="[3.3.0,4.0.0)"

The plugin simply calls some code from the QuitAction.

Please make the code in the QuitAction of Eclipse reusable and call it according to the "Workspace save interval".

Possibly related bugs:

Bug 2369 which requests a way to save a workbench state to a file and restore it later (so you can have *several* workbench states)

Bug 332564; that bug is pretty similar to this one but it was closed as a duplicate of Bug 2369 which is probably wrong and it doesn't contain a fix.

Reproducible: Always

Steps to Reproduce:
1. Start Eclipse
2. Open a file in an editor
3. Close Eclipse
4. Start again
5. Open a second file
6. Wait five minutes :)
7. Kill Eclipse from the command line (do not quit)
8. Start again

-> Only the first file is opened.
Comment 1 Remy Suen CLA 2011-02-18 12:25:52 EST
That preference (In reply to comment #0)
> Setting the "Workspace save interval" to any value has no effect; if Eclipse
> crashes, the workspace is restored to the state it had when it was closed the
> last time.

The problem you describe is the _layout_ of the workbench and its windows and is not relevant to this preference (which is talking about the workspace at the level pertaining to files and folders).
Comment 2 Aaron Digulla CLA 2011-02-20 10:46:52 EST
Created attachment 189362 [details]
Save UI State plugin [3.3 - 4.0)

This is a patched version of the "save ui state" plugin mentioned in the first comment. The only change is that it works for any version of Eclipse 3.3 <= version < 4.0.
Comment 3 Aaron Digulla CLA 2011-02-20 10:51:13 EST
(In reply to comment #1)

> The problem you describe is the _layout_ of the workbench and its windows and
> is not relevant to this preference (which is talking about the workspace at the
> level pertaining to files and folders).

I see; this means that if I don't press "Save" or "Save All", all modified editors will be saved at 5 minute intervals.

I'm not sure that makes sense or is what the user expects:

1. With "save before build", I can make sure that editors are saved when it makes sense (instead of by an arbitrary time interval).

2. The preference's label says "save workspace", not "save modified editors".

So please change the text to "Modified editors save interval" or "Modified editors saved every" and create a new preferences "Workspace state save interval" which triggers the code from QuitAction.
Comment 4 Remy Suen CLA 2011-02-20 21:15:04 EST
(In reply to comment #3)
> I see; this means that if I don't press "Save" or "Save All", all modified
> editors will be saved at 5 minute intervals.

Actually, that's not what the preference means/is for. This is for workspace snapshots and is not related to dirty editors.
Comment 5 Aaron Digulla CLA 2011-02-21 02:55:28 EST
(In reply to comment #4)

> Actually, that's not what the preference means/is for. This is for workspace
> snapshots and is not related to dirty editors.

What is a "workspace snapshot"?
Comment 6 Szymon Brandys CLA 2011-02-21 07:19:31 EST
(In reply to comment #5)
> (In reply to comment #4)
> 
> > Actually, that's not what the preference means/is for. This is for workspace
> > snapshots and is not related to dirty editors.
> 
> What is a "workspace snapshot"?

http://wiki.eclipse.org/FAQ_How_and_when_do_I_save_the_workspace%3F
Comment 7 Aaron Digulla CLA 2011-02-21 08:21:39 EST
Okay, I'm confused.

If this preference is for "workbench snapshots", then it doesn't work as advertised (as my example shows). Or the preference "Workspace save interval" is not for "workbench snapshots" in which case comment #3 applies.

Remy, Szymon can you please make up your mind what we're talking about here? I'm just a user of Eclipse, I'm not an expert of the terminology.

From my point of view, the workspace state/layout/whatever-you-name-it isn't saved but when I quit the IDE. What I want is that Eclipse saves it's state more often and in an atomic way (but that's another bug).
Comment 8 Remy Suen CLA 2011-02-21 08:35:45 EST
(In reply to comment #7)
> If this preference is for "workbench snapshots", then it doesn't work as
> advertised (as my example shows). Or the preference "Workspace save interval"
> is not for "workbench snapshots" in which case comment #3 applies.
> 
> Remy, Szymon can you please make up your mind what we're talking about here?
> I'm just a user of Eclipse, I'm not an expert of the terminology.

This snapshot is for workspace resource metadata (such as what markers have been created) and what files and folders are known to the Eclipse workspace (as you probably know, when you make changes to the file system outside of Eclipse sometimes you have to use F5 to refresh in Eclipse for it to be picked up).

To make it clear, this preference has absolutely nothing to do with what views and editors you have open.

> From my point of view, the workspace state/layout/whatever-you-name-it isn't
> saved but when I quit the IDE.

Yes, this is a known problem and as you pointed out in comment 0 there are already other bugs on this topic.

Is there still any confusion over what this checkbox preference is for?
Comment 9 Aaron Digulla CLA 2011-02-21 09:58:57 EST
(In reply to comment #8)

> To make it clear, this preference has absolutely nothing to do with what views
> and editors you have open.

Since this is something the user should never change (the IDE should always get it right without any manual interaction - it's config, not a preference), I still vote to change the effect of this useless field to save the workbench state/layout/whatever.

> > From my point of view, the workspace state/layout/whatever-you-name-it isn't
> > saved but when I quit the IDE.
> 
> Yes, this is a known problem and as you pointed out in comment 0 there are
> already other bugs on this topic.

Note that those bugs ask for different things; I just want Eclipse to be more stable by default. When it crashes, it should be able to restore what I saw last time. Bug 2369 asks to save several states manually (not what I want).

So either reopen Bug 332564 or keep this one.

> Is there still any confusion over what this checkbox preference is for?

It's a text field, not a checkbox. Again, I'm unsure that you understand what I'm talking about.
Comment 10 Remy Suen CLA 2011-02-21 10:02:30 EST
(In reply to comment #9)
> It's a text field, not a checkbox.

Sorry, I instinctively said checkbox by mistake. You are right it is a text field.
Comment 11 John Arthorne CLA 2011-05-25 08:51:32 EDT

*** This bug has been marked as a duplicate of bug 206364 ***
Comment 12 Remy Suen CLA 2011-05-25 08:58:36 EDT
(In reply to comment #11)
> *** This bug has been marked as a duplicate of bug 206364 ***

That is an unrelated bug. We are not talking about preferences here.

Aaron wants the workbench windows' layouts to be persisted on a regular basis (or perhaps more accurately, in "real-time" per comment 9 as Aaron expects identical layout recovery upon crash).
Comment 13 John Arthorne CLA 2011-05-25 12:07:09 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > *** This bug has been marked as a duplicate of bug 206364 ***
> 
> That is an unrelated bug. We are not talking about preferences here.
> 
> Aaron wants the workbench windows' layouts to be persisted on a regular basis
> (or perhaps more accurately, in "real-time" per comment 9 as Aaron expects
> identical layout recovery upon crash).

I don't think bug 206364 is talking about preferences either. Although that word is in the title, the bug is really about workbench/window layout. Preferences are generally persisted as soon as they are changed, so the real issue is other UI state. I think both are really duplicates of bug 2369, but if you want to keep more bugs open it's up to you ;)
Comment 14 Aaron Digulla CLA 2011-09-02 09:23:15 EDT
I agree. Closing as duplicate.

*** This bug has been marked as a duplicate of bug 2369 ***