Bug 490780 - ACTIVE_PART is initially not properly set when switching perspective
Summary: ACTIVE_PART is initially not properly set when switching perspective
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-31 07:47 EDT by Simon Scholz CLA
Modified: 2021-05-30 08:49 EDT (History)
3 users (show)

See Also:


Attachments
Sample application which shows the bug (13.48 KB, application/zip)
2016-03-31 07:47 EDT, Simon Scholz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Scholz CLA 2016-03-31 07:47:34 EDT
Created attachment 260642 [details]
Sample application which shows the bug

Yesterday I created additional tests for Bug 489856 and at first I thought my implementation in Bug 489856 is buggy, but now after creating a sample app to see what's happening when switching perspectives for the first time, I realized that it is a different bug.

org.eclipse.e4.ui.tests.workbench.PartOnTopManagerTest.test_PlaceholderOnTopPerspectiveSwitch() in https://git.eclipse.org/r/#/c/68725/5/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartOnTopManagerTest.java is the test, which fails due to this bug.

When a MPlaceholder in a perspective is selected and you switch to a second perspective, that also contains this MPlaceholder, for the first time this MPlaceholder is considered as ACTIVE_PART and therefore is on top of a MPartStack even though this MPartStack has a different selectedElement.

If you have a look at the attached sample app, you will see that the "Second Perspective" has a "org.eclipse.2ndPerspective.partstack" PartStack which contains a Part and a Placeholder. When selecting the PartStack in the Model-Editor you can see that the "Sample Part" is the selectedElement in this PartStack. Nevertheless when running the app and switching to the "Second Perspective" for the first time the "Shared Part" is selected in the "Second Perspective", which is wrong according to the selected element in the model. 
In order to see the bug, you just need to run the sample app and press on "Switch Perspective" in the main toolbar and you'll see that the "Shared Part" is selected in the PartStack and not the "Sample Part".

I hope the sample makes it clear.
Comment 1 Andrey Loskutov CLA 2016-03-31 08:08:08 EDT
Most likely this is another incarnation of bug 489335 and at least closely related to this.

Can you check if the patch https://git.eclipse.org/r/68181/ solves the problem?
Comment 2 Simon Scholz CLA 2016-03-31 08:16:29 EDT
Thanks Andrey, I just checked out the patch and ran the sample app, but unfortunately the problem remains.

Yesterday when I debugged this issue I saw that this happens when the activeChildContext is changed and the actualArgs of the MethodRequestor reference the Placeholder. Somehow this also affects the ACTIVE_PART being incorrectly set to the Placeholder rather than the really selected element of a PartStack.
Comment 3 Rolf Theunissen CLA 2019-06-09 09:54:29 EDT
When switching the active part, there is a period in which there is inconsistency between IServiceConstants.ACTIVE_PART in the context and PartService#getActivePart.

This is probably related, see Bug 414544.
Comment 4 Eclipse Genie CLA 2021-05-30 08:49:06 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.