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

Bug 361580

Summary: The Contributed part renderer's 'getUIContainer' can throw a CCE for a part contained in a sash Container
Product: [Eclipse Project] Platform Reporter: Eric Moffatt <emoffatt>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: elaskavaia.cdt, loskutov
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Eric Moffatt CLA 2011-10-20 14:41:56 EDT
Found while fixing Bug 361290; this is an admittedly odd case since it involves the hosting of the MPart's toobar under the MPart's parent (even though it's a child of the MPart).

The issue is that the current code simply returns the 'widget', expecting it to be a control. In the case where the part is 'stand alone' it can be a child of an MPSC which, except for the root, has a Rectangle as its widget (thus the CCE).

We should check this and call the MPSC's 'getUIContainer' if we detect that the widget is not a control. I'm still looking into whether the approach of *always* using the parent's getUIContainer makes sense...
Comment 1 Eric Moffatt CLA 2011-10-20 14:42:30 EDT
Setting up for a look in M4.
Comment 2 Eric Moffatt CLA 2011-12-09 11:40:33 EST
Moving to M5.
Comment 3 Eric Moffatt CLA 2012-04-17 13:49:58 EDT
I haven't seen this in some time...deferring...
Comment 4 Eric Moffatt CLA 2012-08-16 11:08:59 EDT
I'll defer this to 4.3 or until we get bug reported against it...
Comment 5 Eclipse Genie CLA 2020-07-10 10:18:02 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.
Comment 6 Elena Laskavaia CLA 2022-06-07 08:22:42 EDT
Still happening - I have standalone view (a view directly in perspective with nothing else)

org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: class org.eclipse.swt.graphics.Rectangle cannot be cast to class org.eclipse.swt.widgets.Composite (org.eclipse.swt.graphics.Rectangle and org.eclipse.swt.widgets.Composite are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @6622a690)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68)
	at org.eclipse.e4.core.di.internal.extensions.EventObjectSupplier$DIEventHandler.handleEvent(EventObjectSupplier.java:92)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.e4.ui.model.application.ui.impl.UIElementImpl.setVisible(UIElementImpl.java:361)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.showElementRecursive(LazyStackRenderer.java:307)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.showElementRecursive(LazyStackRenderer.java:354)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.showElementRecursive(LazyStackRenderer.java:354)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.showElementRecursive(LazyStackRenderer.java:354)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.showTab(LazyStackRenderer.java:219)
	at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:88)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:83)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:5855)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:219)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:152)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1)
	at org.eclipse.ui.internal.WorkbenchPage.busySetPerspective(WorkbenchPage.java:4002)
	at org.eclipse.ui.internal.WorkbenchPage.lambda$10(WorkbenchPage.java:3974)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3974)
	at org.eclipse.ui.internal.Workbench.activate(Workbench.java:2863)
	at org.eclipse.ui.internal.Workbench.busyShowPerspective(Workbench.java:2904)
	at org.eclipse.ui.internal.Workbench.lambda$18(Workbench.java:2879)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.Workbench.showPerspective(Workbench.java:2877)
	at org.eclipse.ui.internal.Workbench.showPerspective(Workbench.java:2852)
	at com.qnx.swupdate.ui.p2.PerspectiveSwitcher.lambda$1(PerspectiveSwitcher.java:118)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:5855)
	at com.qnx.swupdate.ui.p2.PerspectiveSwitcher.switchToPerspective(PerspectiveSwitcher.java:115)
	at com.qnx.swupdate.ui.p2.PerspectiveSwitcher.switchToPerspectiveAndOpenView(PerspectiveSwitcher.java:93)
	at com.qnx.swupdate.ui.p2.parts.WelcomePagePart$SwitcherAction.run(WelcomePagePart.java:153)
	at com.qnx.swupdate.ui.p2.parts.WelcomePagePart$ManageLicenseKeyAction.run(WelcomePagePart.java:548)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
	at com.qnx.swupdate.ui.util.controls.SideBarComposite$2.linkActivated(SideBarComposite.java:132)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:215)
	at org.eclipse.ui.forms.widgets.ImageHyperlink.handleActivate(ImageHyperlink.java:212)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:309)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink.lambda$3(AbstractHyperlink.java:117)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5745)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1427)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5013)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4507)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:153)
	at com.qnx.swupdate.app.Application.startQSCApplication(Application.java:74)
	at com.qnx.swupdate.core.QSCApplication.start(QSCApplication.java:65)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	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:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.ClassCastException: class org.eclipse.swt.graphics.Rectangle cannot be cast to class org.eclipse.swt.widgets.Composite (org.eclipse.swt.graphics.Rectangle and org.eclipse.swt.widgets.Composite are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @6622a690)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.subscribeVisibilityHandler(PartRenderingEngine.java:214)
	at jdk.internal.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
Comment 7 Andrey Loskutov CLA 2022-06-08 08:20:18 EDT

*** This bug has been marked as a duplicate of bug 570176 ***