Bug 514935 - Reset of Perspective restores not restorable views
Summary: Reset of Perspective restores not restorable views
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 4.8 M5   Edit
Assignee: Eugen Neufeld CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-07 09:26 EDT by Eugen Neufeld CLA
Modified: 2019-08-09 06:41 EDT (History)
3 users (show)

See Also:


Attachments
Example App (62.34 KB, application/zip)
2017-04-07 09:26 EDT, Eugen Neufeld CLA
no flags Details
Example app with new window menu (69.22 KB, application/zip)
2017-12-04 03:41 EST, Alexandra Buzila CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugen Neufeld CLA 2017-04-07 09:26:08 EDT
Created attachment 267698 [details]
Example App

If you have a saved perspective with a non-restorable view which is hidden after a restart, then after a reset of the perspective the view is visible again.

The problem is, that the information about the restorable flag is only available on IViewDescriptor.
And the reset is happening using a clone of the perspective in org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.cloneSnippet(MSnippetContainer, String, MWindow).
Here the toBeRendered flag of all parts and placeholders is reset to be true. And without the information about the restorable flag, all those views are also shown.

I would suggest to introduce a restorable flag to e4 and hide all parts with such a flag on clone.

I created a minimal example.
Steps to reproduce:
1. Start application
2. File -> Open View  (2 View 'name' is visible)
3. Save perspective -> Save as ...
4. Close application
5. Start application again
6. 2 View 'name' is not visible
7. Reset Perspective -> Reset
8. 2 View 'name' is visible 

Cheers,
Eugen
Comment 1 Andrey Loskutov CLA 2017-04-07 09:58:19 EDT
Eugen, would you like to propose a patch via Gerrit? See https://wiki.eclipse.org/Platform_UI/How_to_Contribute.
Comment 2 Eugen Neufeld CLA 2017-04-07 11:04:52 EDT
Hi Andrey, 
yes I will create a patch for this.
Any hints where to add the restore flag constant to? I would have added it to the IPresentationEngine.

Cheers,
Eugen
Comment 3 Eclipse Genie CLA 2017-04-13 11:41:14 EDT
New Gerrit change created: https://git.eclipse.org/r/95014
Comment 5 Andrey Loskutov CLA 2017-09-08 07:26:42 EDT
@Eugen: please fix 2 API errers introduced with the patch. Please install API tools to avoid such issues next time.
Comment 6 Eclipse Genie CLA 2017-09-08 08:12:02 EDT
New Gerrit change created: https://git.eclipse.org/r/104747
Comment 8 Andrey Loskutov CLA 2017-09-08 10:44:57 EDT
(In reply to Eclipse Genie from comment #7)
> Gerrit change https://git.eclipse.org/r/104747 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=bf9900914642c4f5fd011106eeb67590f3f4f715

This should fix issues from comment 5.

@Eugen: is there anything to do left for the original issue? If yes, please explain what, if not, please set this bug as resolved/fixed.
Comment 9 Alexander Kurtakov CLA 2017-09-12 03:37:00 EDT
Marking as resolved for M2. If there is still work pending please reopen.
Comment 10 Alexandra Buzila CLA 2017-11-27 09:27:21 EST
We found a problem with the fix for this bug: if a perspective is saved and a new window is opened afterwards, the content of the restorable views is being moved to the new window.

I am reopening this and will contribute a fix shortly.
Comment 11 Andrey Loskutov CLA 2017-12-03 11:08:15 EST
(In reply to Alexandra Buzila from comment #10)
> We found a problem with the fix for this bug: if a perspective is saved and
> a new window is opened afterwards, the content of the restorable views is
> being moved to the new window.

Not sure I can follow. What do you mean by "the content of the restorable views is being moved to the new window"?

Can you please give step by step instructions to reproduce the problem?

> I am reopening this and will contribute a fix shortly.

@Eugen, it would be nice you could review it. Tomorrow is last day for M4 contributions.
Comment 12 Alexandra Buzila CLA 2017-12-04 03:41:42 EST
Created attachment 271754 [details]
Example app with new window menu

I'm attaching an example app that can be used to reproduce the problem.

Steps to reproduce:
- Launch the sample application. A perspective with a view restorable view should be visible.
- From the context menu of the perspective, save the current perspective under another name using the "Save As.." option
- From the File menu, select the "New Window" item. This should open a new application window that contains the same view, but the content of this view is gone from the main window and only visible in the new window.

This behavior can be reproduced in Photon and was introduced by the initial fix for this bug.
Comment 13 Dani Megert CLA 2017-12-05 12:10:24 EST
This bug did not get delivered for the specified target milestone. Please set the target milestone when you plan to deliver the fix.
Comment 14 Eugen Neufeld CLA 2017-12-05 15:48:40 EST
The fix is pushed to gerrit and looks good.
As I am not a committer I cannot merge it.
Comment 15 Andrey Loskutov CLA 2017-12-05 15:56:05 EST
(In reply to Eugen Neufeld from comment #14)
> The fix is pushed to gerrit and looks good.
> As I am not a committer I cannot merge it.

Thanks, but also as non-committer you still can comment and give your vote on it.
Comment 16 Eugen Neufeld CLA 2017-12-05 16:27:47 EST
Yes, I did so on Monday, but that might have been to late.
I updated the Target Milestone. Sorry for the delay.
Comment 17 Andrey Loskutov CLA 2017-12-08 11:38:56 EST
(In reply to Eugen Neufeld from comment #16)
> Yes, I did so on Monday, but that might have been to late.
> I updated the Target Milestone. Sorry for the delay.

Can you please check if the bug 528189 is related and will be fixed by the proposed patch? Thanks!
Comment 19 Alexandra Buzila CLA 2017-12-11 09:30:09 EST
(In reply to Andrey Loskutov from comment #17)
> (In reply to Eugen Neufeld from comment #16)
> > Yes, I did so on Monday, but that might have been to late.
> > I updated the Target Milestone. Sorry for the delay.
> 
> Can you please check if the bug 528189 is related and will be fixed by the
> proposed patch? Thanks!

Hi Andrey! I tested the fix for this bug and it does not affect the behavior described in bug 528189. At a first glance the issues look unrelated.
Comment 20 Alexandra Buzila CLA 2017-12-11 09:58:22 EST
Verified in I20171210-2000