Bug 355750 - WorkbenchWindowAdvisor#isDurableFolder() doesn't survive a save and restore
Summary: WorkbenchWindowAdvisor#isDurableFolder() doesn't survive a save and restore
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: bugday, helpwanted
: 345050 (view as bug list)
Depends on: 355763
Blocks:
  Show dependency tree
 
Reported: 2011-08-24 13:07 EDT by Thomas Schindl CLA
Modified: 2019-11-18 12:19 EST (History)
8 users (show)

See Also:


Attachments
Patch (2.50 KB, patch)
2011-08-24 14:02 EDT, Thomas Schindl CLA
no flags Details | Diff
example project (110.44 KB, application/octet-stream)
2011-08-24 14:03 EDT, Thomas Schindl CLA
no flags Details
Revised patch to never create a ContainerPlaceholder for a 'durable' stack (1.92 KB, patch)
2011-08-26 14:31 EDT, Eric Moffatt CLA
no flags Details | Diff
Patch (5.24 KB, patch)
2011-09-28 06:19 EDT, Thomas Schindl CLA
no flags Details | Diff
Screen shot of the sample app if you minimize the 'messages' stack (16.23 KB, image/png)
2011-09-28 14:47 EDT, Eric Moffatt CLA
no flags Details
Patch (4.52 KB, patch)
2011-09-29 15:46 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2011-08-24 13:07:34 EDT
The API introduced in bug 213645 is not working in conjunction with save and restore. I've tried debugging in the workbench a bit but I must admit I have no clue what needs to be changed.

Any pointers how we can achieve this would appreciateds so that I can prepare a patch for 3.8
Comment 1 Thomas Schindl CLA 2011-08-24 14:02:05 EDT
Created attachment 202102 [details]
Patch

This fixes the problem for me - can someone review that and tell me if I'm on a completely wrong track?
Comment 2 Thomas Schindl CLA 2011-08-24 14:03:30 EDT
Created attachment 202103 [details]
example project
Comment 3 Eric Moffatt CLA 2011-08-26 14:31:06 EDT
Created attachment 202248 [details]
Revised patch to never create a ContainerPlaceholder for a 'durable' stack


Tom, the original patch worked but was overkill since the 'replacePlaceholderWithPart(LayoutPart)' is called for every part in the presentation.

This patch just augments your change to the ViewSashContainer's restoreState method to not create a ContainerPlaceholder if the actual ViewStack is to be 'durable'.

I'll commit this into 3.8 and I'll open a new defect to see if we can get it into 3.7.2 (no promises but we can show that the change can only affect 'durable' ViewStacks and is otherwise without side-effects).
Comment 4 Eric Moffatt CLA 2011-08-26 14:35:09 EDT
Committed in >20110826. Applied the revised patch.
Comment 5 Eric Moffatt CLA 2011-08-26 14:36:04 EDT
Tom, get back to me if there are any issues with this. I tested it using your example project (thanks!) and it appears to work fine.
Comment 6 Thomas Schindl CLA 2011-09-07 09:08:04 EDT
> I'll commit this into 3.8 and I'll open a new defect to see if we can get it
> into 3.7.2 (no promises but we can show that the change can only affect
> 'durable' ViewStacks and is otherwise without side-effects).

Did you opened a bug for this Eric? I have no problem rolling my own workbench-plugin but getting it from upstream would certainly make my life easier.

Tom
Comment 7 Eric Moffatt CLA 2011-09-19 15:04:46 EDT
The current fix for this introduces a regression into the existing work flows (see bug 358119 for details).

We need the perspective's id in order to make the 'isDurable' API call to the advisor. Not sure what the correct fix is yet...
Comment 8 Thomas Schindl CLA 2011-09-20 04:27:14 EDT
Well first of all isDurable is used mainly RCP applications who normally not hit by the problem we are seeing here because this happens only if a perspective is restored in a New Window, so we could simply add a check for null-check and omit the call isDurable() - in the other parts where the call is done there's also a check if the descriptor is not null BTW.

I think we need to document the fact that we are not calling isDurable() in the above mentionned case.

Another interesting question naturally is also why the perspective is not set when we restore a view in a new window.
Comment 9 Thomas Schindl CLA 2011-09-20 05:25:18 EDT
I start to ask myself why Boris introduce this by setting a boolean field and not simply invoking the check on the advisor when getDurable() is called. Then this would not be different whether the folder is restored or created from scratch
Comment 10 Thomas Schindl CLA 2011-09-21 05:05:23 EDT
Eric, I think we don't need to store those in the ViewStack. I've taken a look and the getDurable() is only used in the PerspectiveHelper. Instead of storing/restoring the durable information we can simply test in the PerspectiveHelper by calling the WindowAdvisor.

The problem with we are seeing when a perspective is restored in a new window the perspective is set after the restore happened. I'll prepare a patch.
Comment 11 Thomas Schindl CLA 2011-09-21 05:22:51 EDT
and btw your fix didn't worked out fully because when one restored a ViewStack which is empty it was hidden. I think we should remove the durable-attribute and implement the logic inside the PerspectiveHelper where we are guaranteed to have the perspective.
Comment 12 Eric Moffatt CLA 2011-09-23 16:11:00 EDT
Tom, any chance you could make a patch ? I think I understand but I read code better...;-).
Comment 13 Thomas Schindl CLA 2011-09-23 16:14:04 EDT
It's at the top of my work queue for Monday
Comment 14 Eric Moffatt CLA 2011-09-23 16:23:41 EDT
Beauty, mine too :)
Comment 15 Thomas Schindl CLA 2011-09-28 06:19:36 EDT
Created attachment 204162 [details]
Patch

This patch completely removes the durable-attribute and simply calls out to the advisor when needed. If I read the code correct this perspective is guaranteed to be set when when helper is invoked and so we don't run in the NPE like the one in bug 358119. Now the only question I'm still uncertain about is why Boris introduced the durable attribute, am I missing a race condition here e.g. with the window-advisor?
Comment 16 Thomas Schindl CLA 2011-09-28 06:59:51 EDT
Boris - do you by chance remember why you added this durable attribute?
Comment 17 Eric Moffatt CLA 2011-09-28 14:34:58 EDT
Tom, this patch looks good. I'm just being a bit more diligent about testing this time. 

I think you are correct though in that by placing the code directly into the PerspectiveHelper is should be *impossible* to not be able to get its id as needed...

The only concern I have is that the ViewStack is still using the 'durable' field in 'setMinimized' but the field no longer reflects the actual 'durable' state. This ends up leaving the window in an incorrect state if you minimize a 'durable' folder (screen shot coming).

Let me see if I can work around that since the code that's in 'setMinimized' is a hack to get around the issue and there's already added logic in the PerspectiveHelper regarding min/max (so adding a special check to 'isDurable' to return false under this condition isn't really too bad I think).
Comment 18 Eric Moffatt CLA 2011-09-28 14:47:14 EDT
Created attachment 204212 [details]
Screen shot of the sample app if you minimize the 'messages' stack


Since the field is no longer used by the PerspectiveHelper the code no longer works.
Comment 19 Eric Moffatt CLA 2011-09-29 10:14:48 EDT
Tom, I'm still working on this but my first three tries...#fail. Sheesh, the 3.x codebase is complicated (it's been a while since I've had to . 

I've gone back to your original patch since is still has the field in use (changing the min/max implementation is hairier than getting this working I suspect).
Comment 20 Thomas Schindl CLA 2011-09-29 15:46:42 EDT
Created attachment 204324 [details]
Patch

This patch is an improved version from the very first one:
a) durable replacement happens in PerspectiveHelper
b) It takes care of minimized stacks by consulting the perspectives memento
Comment 21 Eric Moffatt CLA 2011-10-07 11:32:13 EDT
Thanks Tom, I'm going to do both this patch as well as the fix for bug 355763 at the same time since the NO_CLOSE tag is the 'e4' version of 'durable'...
Comment 22 Eric Moffatt CLA 2011-10-07 13:31:53 EDT
OK, as far as I can tell this one doesn't introduce any issues in the IDE itself and looks safe.

There is still one corner case that's not perfect. If you minimize the durable stack and close its last view while its minimized the stack disappears from the trim but does *not* show back up in the UI.

If you are OK with that then I'll commit this patch. It may be possible to detect when a 'durable' but minimized stack goes empty and force a restore on it from the FastViewManager...

Let me know what you think.
Comment 23 Remy Suen CLA 2011-10-11 18:20:32 EDT
*** Bug 345050 has been marked as a duplicate of this bug. ***
Comment 24 Thomas Schindl CLA 2012-04-13 11:30:15 EDT
We can fix this now easily in 4.x by using the NO_AUTO_CLOSE tag introduced in bug 355763
Comment 25 Eric Moffatt CLA 2014-04-07 10:43:19 EDT
What's the current state of this defect ? I'm considering moving if out of Luna...
Comment 26 Reto Urfer CLA 2014-06-03 12:02:47 EDT
In Eclipse3 compatibility mode the method WorkbenchWindowAdvisor#isDurableFolder() is never called and therefore the tag "NoAutoCollapse" is not defined in the corresponding MStack model elements with the result that the Folder will be always collapsed when the last part is closed
Comment 27 Eclipse Genie CLA 2019-11-18 12:19:14 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.