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

Bug 299379

Summary: Activation of a newly added view does not work
Product: [Eclipse Project] e4 Reporter: Oleg Besedin <ob1.eclipse>
Component: UIAssignee: Project Inbox <e4.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bokowski, emoffatt, remy.suen
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Illustrative patch - not a general fix - not meant to be applied
none
StackRenderer patch v2
none
A simpler patch none

Description Oleg Besedin CLA 2010-01-12 10:12:51 EST
Created attachment 155868 [details]
Illustrative patch - not a general fix - not meant to be applied

The activation of a newly added view does not seem to work as the activation request is processed before the actual ETab item is created in the ETabFolder.

To reproduce:
- Launch the product from the "org.eclipse.e4.ide.application" bundle to create launch configuration
- Add the photo demo bundle to the launch configuration
- Launch the product + photo demo bundle; use Window -> Show View item. Select "Library" view, press OK, 
- Note that the "Library" view is added to the correct primary navigation stack on the left, but not activated.
- Clicking on the tab for the "Library" view will activate it and make content visible.

The code called to activate is PartServiceImpl#showPart() -> PartServiceImpl#activate(MPart).

Attached patch makes couple funny changes to make activation work. The patch, of course, is for illustration only and not meant to be applied.
Comment 1 Remy Suen CLA 2010-01-15 14:19:40 EST
Created attachment 156265 [details]
StackRenderer patch v2
Comment 2 Boris Bokowski CLA 2010-01-15 15:31:28 EST
Remy's patch looks like it goes in the right direction. Eric - any comments, or should Remy just commit the change?
Comment 3 Remy Suen CLA 2010-01-18 10:13:34 EST
<rcjsuen> emoffatt: if i add a part to a stack that has no children, should it be selected?
<emoffatt> rcjsuen: seems reasonable to me

Do we want to open a separate bug on this topic? I can't get editors to render when they're opened (but views work @_@), I don't know if it's related or not.
Comment 4 Eric Moffatt CLA 2010-01-18 11:12:17 EST
Created attachment 156398 [details]
A simpler patch


The PRE already listens to children being added/removed and calls the renderer's showChild/hideChild methods (that's why the tab gets created).

Since the code that's opening the view has already declared that the new element is the selected one (i.e. the stack's getActiveChild is already correct) all this code does is make sure that when a child gets added or removed that the active child is handled correctly.
Comment 5 Eric Moffatt CLA 2010-01-18 13:30:42 EST
Committed in >20100118. Applied my patch.