Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 295250 - ContributedPartRenderer eagerly activates constructed parts in createWidget
Summary: ContributedPartRenderer eagerly activates constructed parts in createWidget
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.0 M4   Edit
Assignee: Remy Suen CLA
QA Contact: Eric Moffatt CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-16 09:13 EST by Remy Suen CLA
Modified: 2010-01-25 13:39 EST (History)
0 users

See Also:


Attachments
ContributedPartRenderer patch v1 (7.30 KB, patch)
2010-01-22 12:48 EST, Remy Suen CLA
no flags Details | Diff
ContributedPartRenderer patch v2 (7.48 KB, patch)
2010-01-25 13:38 EST, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2009-11-16 09:13:19 EST
I was wondering why my part was becoming active when I noticed the two lines of code below in CPR...

parentContext.set(IContextConstants.ACTIVE_CHILD, localContext);

activate(element);

This eager activation is in direct conflict with the 3.x IWorkbenchPage's showView method with a IWorkbenchPage.VIEW_CREATE mode passed in.
Comment 1 Eric Moffatt CLA 2009-11-16 13:26:58 EST
We should revisit any code that is calling 'activate' to separate activation from the rendering completely (i.e. the rendering engine should not be making the decision on what's 'active' since that's essentially a context oriented operation.

One scenario we should consider is the difference between the user clicking on a tab versus the stack's 'activeChild' being set. In the click case we likely want the part activated but not necessarily so for the 'bring to top' case.
Comment 2 Remy Suen CLA 2009-11-18 11:38:58 EST
Eric, I suggest we pull this code out (the two lines specified in comment 0) for M3, any objections?
Comment 3 Eric Moffatt CLA 2009-11-19 12:46:29 EST
Not at all..;-)
Comment 4 Remy Suen CLA 2009-11-19 12:53:24 EST
Removing the two lines can cause an infinite loop because the window context thinks itself is the active child (not too sure how this happened). Uncommenting line 55 in LazyStackRenderer seems to fix the problem though the proper fix would probably be to add activation code for when the tab has been selected per what's been suggested in comment 1.
Comment 5 Remy Suen CLA 2010-01-11 06:58:16 EST
(In reply to comment #4)
> Removing the two lines can cause an infinite loop because the window context
> thinks itself is the active child (not too sure how this happened).

May be caused by bug 299195.
Comment 6 Remy Suen CLA 2010-01-22 12:48:13 EST
Created attachment 156965 [details]
ContributedPartRenderer patch v1

This bug is making it difficult for me to implement the compatibility layer as I need to be able to show parts without activating them.
Comment 7 Remy Suen CLA 2010-01-25 13:38:49 EST
Created attachment 157149 [details]
ContributedPartRenderer patch v2

Changed StackRenderer to pick the part that's being shown instead of the first child.
Comment 8 Remy Suen CLA 2010-01-25 13:39:47 EST
(In reply to comment #7)
> Created an attachment (id=157149) [details]
> ContributedPartRenderer patch v2

Patch released to HEAD.