This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 380321 - View management does not respect "Do not open..." setting
Summary: View management does not respect "Do not open..." setting
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.4 M6   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard: candidate43
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-22 15:39 EDT by Marc Khouzam CLA
Modified: 2014-03-04 08:16 EST (History)
7 users (show)

See Also:


Attachments
Fire the perspectivelistener2 changed event on a hide (941 bytes, patch)
2012-05-29 10:40 EDT, Eric Moffatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2012-05-22 15:39:14 EDT
When using CDT, if I have the View Management enabled with the Debug perspective, the Memory and Registers view keep opening at every launch, although I manually closed them.  I have the "Do not open..." option ticked, but it does not help.
Comment 1 Pawel Piech CLA 2012-05-22 17:06:39 EDT
I'm not able to reproduce this problem:

My steps are:
1) Launch a CDT debug session (mem view opens).
2) While CDT debug session is active, close memory view.
3) Terminate CDT debug session.
4) Start CDT debug session.  

At this point, the memory view doesn't open.

Note, if you terminate debug session, then close mem view.  The closing will not be remembered.
Comment 2 Marc Khouzam CLA 2012-05-23 14:11:05 EDT
(In reply to comment #1)

I tried with a brand new workspace, using master from platfrom Debug and CDT.

> My steps are:
> 1) Launch a CDT debug session (mem view opens).

yes

> 2) While CDT debug session is active, close memory view.

yes

> 3) Terminate CDT debug session.
> 4) Start CDT debug session.  

Memory view opens.

5) Terminate CDT session -> memory view closes automatically.

I get the feeling I'm not understanding how this feature should work.  Do you want to do a quick live session to see exactly what I'm doing?  Or I can do some debugging.  Can you recommend a file to focus on?

Thanks
Comment 3 Marc Khouzam CLA 2012-05-24 13:56:17 EDT
I've tried my scenario with 3.8M7 and I don't see the problem.  So, it looks like it is caused by 4.2
Comment 4 Pawel Piech CLA 2012-05-24 14:33:45 EDT
I've debugged this with Marc and found that the ViewContextService is not called when the view is closed.  ViewContextService implements IPerspectiveListener2 and expects to be called on IPerspectiveListner2.perspectiveChanged(..., IWorkbenchPartReference, ..).  Instead it is being called on IPerspectiveListener.perspectiveChagned().

I'm still not able to reproduce this on my system (4.2 or 3.8), but I did see it on Marc's.  Re-assigning to UI to see if there's any known issues with calling IPerspectiveListener2.
Comment 5 Eric Moffatt CLA 2012-05-29 10:40:47 EDT
Created attachment 216402 [details]
Fire the perspectivelistener2 changed event on a hide
Comment 6 Eric Moffatt CLA 2012-05-29 11:13:42 EDT
The previous patch doesn't seem to fix the issue because WorkbenchPage#hideView is never called. I'll continue to look into this...
Comment 7 Pawel Piech CLA 2012-05-29 11:24:16 EDT
(In reply to comment #6)
> The previous patch doesn't seem to fix the issue because WorkbenchPage#hideView
> is never called. I'll continue to look into this...

Thank You.  Let us know whether we should be looking at adding a workaround in Debug.
Comment 8 Eric Moffatt CLA 2012-05-29 13:52:08 EDT
Sorry but I'm going to have to move this out of RC3 and into 4.2.1.

The main problem is that we aren't calling the WorkbenchPage 'hideView' at all so the code to fire the perspective change notifications is never invoked.

Figuring out the correct way to implement this will take longer than we have and the implementation itself is likely too 'deep' to do at this late a stage...

For future reference:

The reason is that we use the e4 mechanisms (set the 'toBeRendered' to false) it tear stuff down. What we're missing is enough life-cycle events in e4 to be able to have the workbench page detect what's going on sufficiently enough to fire the events in the proper order.

One approach is to have the PartRenderingEngine fire about to events before and after the 'createGui' and 'removeGui' calls.

Another approach would be to add a 'TBRChanging' tag when the PRE's toBeRendered handler. We'd add the tag before taking the action (render or unrender, depending), then do the action and then remove the tag.
Comment 9 Wojciech Sudol CLA 2014-02-28 07:23:07 EST
Review URL: https://git.eclipse.org/r/#/c/22631/

When the e4 lifecycle notification for pre-open/close and post-open/close events is ready, this fix need to be improved.

It is worth to mention, that I found one scenario that does not work as I expected, but it behaves in the same way in 3.8.

Steps:
1. Start debugger
2. Close Memory view
3. Finish debugging
4. Start debugger (Memory view doesn't open)
5. Open Memory view
6. Finish debugging
7. Close Memory view (surprisingly it is still open)
8. Start debugger
9. Finish debugging

Expected behaviour:
1. After step #6 Memory view closes
2. After step #8 Memory view opens
3. After step #9 Memory view closes

Current behaviour:
1. After step #6 Memory view remains open
2. After step #8 Memory view opens
3. After step #9 Memory view remains open
Comment 10 Eric Moffatt CLA 2014-02-28 10:57:00 EST
Beauty, thanks Wojciech !

This code has already been committed:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=2d9e490d01a99a7ee7801e66d50d1435af00b109

Do you think we should mark this one as fixed and open a separate one for the upgrade to using the new events ?
Comment 11 Wojciech Sudol CLA 2014-03-04 08:15:58 EST
As the original, reported problem has been fixed, I close this bug. For further improvements I have opened the bug 429563.
Comment 12 Wojciech Sudol CLA 2014-03-04 08:16:27 EST
Verified in I20140303-2000.