Community
Participate
Working Groups
I noticed this problem in an e4 RCP application I am working on. If a part is referenced by a placeholder in a stack in the active perspective and you add a new placeholder (pointing to the same part) to another stack in another (inactive, but rendered) perspective, the part disappears from the active perspective. The space and corresponding tab are still there but the part inside it disappears. The reason this happens is because the renderer re-parents the top level Composite of the part to the CTabFolder of the stack in the inactive perspective. I will attach a very simple sample application that demonstrates the issue. The application has two perspectives. To recreate the issue you launch the application (which opens the 1st perspective). Then switch to the 2nd perspective and then back to the 1st perspective. Finally, click a button in the 1st perspective that will programmatically create another MPlaceholder on the 2nd perspective referencing the part displayed in the 1st perspective. At this point, the part will disappear. If this bug were fixed, clicking the button would have no visible impact until the next time you switched to the 2nd perspective.
Created attachment 220992 [details] Sample application demonstrating bug
I meant to note that I tested this behaviour in both 4.2 and 4.1.1. The issue exists in both.
Ben, good pickup. This is indeed an interesting problem...the current code is too simplistic; it assumes that adding elements to existing rendered UI's should cause them to appear. Perhaps we should see if changing the logic to ensure that *parent* of the element being added is 'on top' (i.e. either it or its ancestors are all the 'selecedElement' of any intervening 'stack' containers... ? This would fix this case because the newly added element has an ancestor (its Perspective) that is *not* the selected element of the PerspectiveStack.
Thanks for taking a look at this Eric. Your suggested means of resolution sounds reasonable to me.
Committed: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=cd490a6d008f1daef7365677ba83cd78511fe41a This ensures that rendering the new placeholder will *not* 'adopt' its referenced view unless the placeholder is in the currently active perspective.
Oops, commit in haste and repent at loss of leisure (i.e. I've reverted the fix due to issues with the Welcome handling and I'll try again over the weekend...;-).
OK I've pushed the original fix to gerrit far a look... https://git.eclipse.org/r/22731 I've seen this fail once but can't repro...it doesn't seem to break anything so far...Ben could you check out the patch ?
I'll defer this to M7 since it's not API related...
(In reply to Eric Moffatt from comment #7) > I've seen this fail once but can't repro...it doesn't seem to break anything > so far...Ben could you check out the patch ? I no longer work on the project I was working on where I was using RCP. I will forward this to some colleagues who still do and see if they might take a look. Sorry!
Committed: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4aa8c6db1c9e235e1f3dccbc16450ceb63eccc5a This causes the ElementReferenceRenderer to only 'adopt' the referenced element if it's in the currently active perspective.
We've reverted this fix and will look at it again in M7 Reverted with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=6181cfea6e8683c138f18f6bc65ab35d33e9fa30 PW
For clarity, the issue surrounds a few of our automated tests in this area and not a known functional breakage of the code itself.
Looking at fix https://git.eclipse.org/r/#/c/22731/ It caused a failure and 2 errors in the e4 tests: UIAllTests-fixed org.eclipse.e4.ui.tests.UIAllTests org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests testBug348215_PartPlaceholderContextReparent(org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests) junit.framework.AssertionFailedError at junit.framework.Assert.fail(Assert.java:55) at junit.framework.Assert.assertTrue(Assert.java:22) at junit.framework.Assert.assertTrue(Assert.java:31) at junit.framework.TestCase.assertTrue(TestCase.java:201) at org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests.testBug348215_PartPlaceholderContextReparent(PartRenderingEngineTests.java:2797) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at junit.framework.TestCase.runTest(TestCase.java:176) at junit.framework.TestCase.runBare(TestCase.java:141) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:233) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603) at org.eclipse.equinox.launcher.Main.run(Main.java:1462) at org.eclipse.equinox.launcher.Main.main(Main.java:1438) testBug348069_DetachedPerspectiveWindow_01_TRUE(org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests) java.lang.NullPointerException at org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests.testBug348069_DetachedPerspectiveWindow_01(PartRenderingEngineTests.java:3104) at org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests.testBug348069_DetachedPerspectiveWindow_01_TRUE(PartRenderingEngineTests.java:3112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at junit.framework.TestCase.runTest(TestCase.java:176) at junit.framework.TestCase.runBare(TestCase.java:141) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:233) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603) at org.eclipse.equinox.launcher.Main.run(Main.java:1462) at org.eclipse.equinox.launcher.Main.main(Main.java:1438) testBug348069_DetachedPerspectiveWindow_02_TRUE(org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests) java.lang.NullPointerException at org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests.testBug348069_DetachedPerspectiveWindow_02(PartRenderingEngineTests.java:3170) at org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests.testBug348069_DetachedPerspectiveWindow_02_TRUE(PartRenderingEngineTests.java:3188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at junit.framework.TestCase.runTest(TestCase.java:176) at junit.framework.TestCase.runBare(TestCase.java:141) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at junit.framework.TestSuite.runTest(TestSuite.java:255) at junit.framework.TestSuite.run(TestSuite.java:250) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:233) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603) at org.eclipse.equinox.launcher.Main.run(Main.java:1462) at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Paul, I've pushed a new change set to Gerrit. This one has the original fix as well as a fix to the EModelService#getElementLocation method that is more accurate than the original in that it correctly identifies an MWindow owned by another MWindow as being OUTSIDE_PERSPECTIVE rather than NOT_IN_UI (which is what apparently caused the test errors).
The current patch still causes one failure: UI Test Suite-fixed org.eclipse.ui.tests.UiTestSuite org.eclipse.ui.tests.api.ApiTestSuite org.eclipse.ui.tests.api.IWorkbenchPageTest testSetPartState(org.eclipse.ui.tests.api.IWorkbenchPageTest) junit.framework.AssertionFailedError: A minimized view should be a fast view at junit.framework.Assert.fail(Assert.java:57) at junit.framework.Assert.assertTrue(Assert.java:22) at junit.framework.TestCase.assertTrue(TestCase.java:192) at org.eclipse.ui.tests.api.IWorkbenchPageTest.testSetPartState(IWorkbenchPageTest.java:3091) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) PW
The test problem was a change in the logic of the 'getElementLocation' which used to only return *one* of IN_ACTIVE_PERSPECTIVE or IN_ANY_PERSPECTIVE to return both bits (braking the case statement in WorkbenchPage#getActiveElement). I've pushed a new change to the existing Gerrit patch that restores the old logic and all tests are now green.
(In reply to Paul Webster from comment #13) > Looking at fix https://git.eclipse.org/r/#/c/22731/ > Looks good now. Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=b0a13a0935caedd44f2c25afc1d1305edd81f177 PW
Verified in 4.4.0.I20140501-0200.