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

Bug 311163

Summary: StackRenderer randomly selects the first tab if it has no selection
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Project Inbox <e4.ui-inbox>
Status: RESOLVED FIXED QA Contact: Eric Moffatt <emoffatt>
Severity: major    
Priority: P3    
Version: 1.0   
Target Milestone: 1.0 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Tests patch to reproduce the problem
none
Make bringToTop set the selected element *before* setting the TBR
none
Revert the previous fix and replace it none

Description Remy Suen CLA 2010-04-30 08:23:39 EDT
1. Make a part stack that's not to be rendered and children that's also not to be rendered.
2. Render it, it will automatically select the first child.

1. Make a part stack that's not to be rendered and children that's also not to be rendered.
2. Set the second child to be rendered.
3. Set the stack to be rendered, it will automatically select the first child.
Comment 1 Remy Suen CLA 2010-04-30 08:25:27 EDT
Created attachment 166604 [details]
Tests patch to reproduce the problem

This has the effect of showing two tabs (the first and the desired tab) when you bring a stack back in the compatibility layer.
Comment 2 Remy Suen CLA 2010-04-30 08:30:57 EDT
Forgot to mention where the suspect code is in:

org.eclipse.e4.workbench.ui.renderers.swt.LazyStackRenderer
-postProcess(MUIElement)
Comment 3 Remy Suen CLA 2010-05-03 07:54:30 EDT
(In reply to comment #0)
> 3. Set the stack to be rendered, it will automatically select the first child.

The test checks that the second child is rendered. This may or may not be correct. But logically, it should either have nothing selected or the second child selected. Autoselecting the first child doesn't make any sense.
Comment 4 Remy Suen CLA 2010-06-21 09:22:54 EDT
You can observe this problem quite easily in your 4.0 SDK.

1. Start Eclipse.
2. Close the 'Problems', 'Javadoc', and 'Declaration' view.
3. Ctrl+3 > Javadoc
4. The 'Javadoc' view comes back but the 'Problems' view can also be seen in the tab folder.
5. Oddly enough, if you close the 'Javadoc' view, the entire stack will disappear!
Comment 5 Eric Moffatt CLA 2010-06-21 10:44:06 EDT
Still there, marking for a look in EC1.
Comment 6 Eric Moffatt CLA 2010-06-22 11:41:51 EDT
Created attachment 172433 [details]
Make bringToTop set the selected element *before* setting the TBR
Comment 7 Eric Moffatt CLA 2010-06-22 11:43:03 EDT
Committed in >20100622. Applied the patch.
Comment 8 Eric Moffatt CLA 2010-06-25 09:55:49 EDT
Created attachment 172751 [details]
Revert the previous fix and replace it


This fix does not mess with the TBR/Select order but fixes up the LSR to only 'auto-select' an element that is already TBR & visible true.
Comment 9 Eric Moffatt CLA 2010-06-25 09:56:52 EDT
Committed in >20100625. Applied the patch.