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

Bug 332163

Summary: Shared parts needs to deactivate themselves from their parent context when they are hidden
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Remy Suen <remy.suen>
Severity: major    
Priority: P3 CC: ob1.eclipse, pwebster
Version: 1.0   
Target Milestone: 4.1 M5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
ElementReferenceRenderer patch v1
none
Illustrative patch for EclipseContext - not meant to be applied
none
ElementReferenceRenderer patch v2
none
EPartService patch v3 none

Description Remy Suen CLA 2010-12-08 14:07:49 EST
I20101208-0250

1. Window > Open Perspective > Debug
2. Close all of the views. Making sure that the 'Outline' view is the _last_ one to be closed.
3. Right-click on the 'Java' perspective icon in the corner > Close
4. Now all your menu items are disabled. The only way to sort of restore your state is to use Ctrl+3. You may get a few error dialogs in the beginning but you should be back in business eventually.
Comment 1 Remy Suen CLA 2010-12-09 08:55:52 EST
The 'Debug' perspective has an active child context, okay, that's kind of weird maybe. But what's weirder is that said child context's getParent() returns null.
Comment 2 Remy Suen CLA 2010-12-09 09:01:46 EST
(In reply to comment #1)
> The 'Debug' perspective has an active child context, okay, that's kind of weird
> maybe.

The active child in question is the 'Outline' view's context. This is why step 2 is so important for reproducing this bug.

When the 'Outline' view is hidden in the 'Debug' perspective, its context gets reparented under the 'Java' perspective. However, the 'Debug' perspective still thinks it has an active child (the 'Outline' view). This is why it has an active child even though it has no parts up and why said active child's getParent() returns null (because it was finally disposed when the 'Java' perspective was closed, as there were no perspectives open showing the 'Outline' view).
Comment 3 Remy Suen CLA 2010-12-09 09:39:27 EST
Created attachment 184852 [details]
ElementReferenceRenderer patch v1

When a placeholder is being hidden and its referenced element's context is being reparented, we should deactivate the context before the reparenting operation if we are currently the active child of our original parent.
Comment 4 Oleg Besedin CLA 2011-01-04 16:04:30 EST
Created attachment 186047 [details]
Illustrative patch for EclipseContext - not meant to be applied

On a surface this seems like something that could be fixed in the eclipse context, but such change causes 6 JUnits to fail, including the new JUnit in this bug.
Comment 5 Remy Suen CLA 2011-01-05 09:11:34 EST
Created attachment 186087 [details]
ElementReferenceRenderer patch v2

Slight change for an additional assert statement and copyright header updates.

Thinking about the issue some more I don't think we should arbitrarily deactivate contexts just because the parent has changed as we would then be "randomly" changing the active part of hidden perspectives.
Comment 6 Remy Suen CLA 2011-01-05 09:16:43 EST
(In reply to comment #5)
> Created attachment 186087 [details]
> ElementReferenceRenderer patch v2

Patch released to CVS HEAD.
Comment 7 Remy Suen CLA 2011-01-06 08:18:12 EST
Created attachment 186164 [details]
EPartService patch v3
Comment 8 Remy Suen CLA 2011-01-06 08:19:18 EST
(In reply to comment #7)
> Created attachment 186164 [details]
> EPartService patch v3

Released to HEAD so that the EPS will automatically handle these cases to make life slightly easier for the renderers.
Comment 9 Remy Suen CLA 2011-01-26 08:10:38 EST
Verified with I20110125-2200 on Windows XP.