Community
Participate
Working Groups
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.
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?
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.
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.
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.