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

Bug 354246

Summary: ClassCastException when calling setVisible on an AbstractSWTWidgetRidget
Product: [RT] Riena Reporter: Sabine Achilles <achilles.sabine>
Component: ridgetAssignee: Project Inbox <riena.core-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Sabine Achilles CLA 2011-08-09 09:22:12 EDT
I have a Ridget that extends the AbstractValueRidget. But when I call setVisible on it I get a ClassCastException

java.lang.ClassCastException: de.compeople.scrumbox.client.ridgets.TimeSeriesChartRidget cannot be cast to org.eclipse.riena.ui.ridgets.IMarkableRidget
	at org.eclipse.riena.ui.ridgets.swt.MarkerSupport.getRidget(MarkerSupport.java:281)
	at org.eclipse.riena.ui.ridgets.swt.MarkerSupport.getRidget(MarkerSupport.java:1)
	at org.eclipse.riena.ui.ridgets.AbstractMarkerSupport.getUIControl(AbstractMarkerSupport.java:300)
	at org.eclipse.riena.ui.ridgets.swt.BasicMarkerSupport.getUIControl(BasicMarkerSupport.java:156)
	at org.eclipse.riena.ui.ridgets.swt.BasicMarkerSupport.init(BasicMarkerSupport.java:66)
	at org.eclipse.riena.ui.ridgets.swt.AbstractSWTWidgetRidget.createMarkerSupport(AbstractSWTWidgetRidget.java:399)
	at org.eclipse.riena.ui.ridgets.swt.AbstractSWTWidgetRidget.addMarker(AbstractSWTWidgetRidget.java:108)
	at org.eclipse.riena.ui.ridgets.swt.AbstractSWTWidgetRidget.setVisible(AbstractSWTWidgetRidget.java:304)
	
The reason for this exception is, that AbstractSWTWidgetRidget only implements IBasicMarkableRidget instead of IMarkableRidget. So if you call setVisible a hiddenMarker is about to be added to the List of markers, but the MarkerSupport always thinks the Ridget is an IMarkableRidget, so it crashes.

I think either AbstractSWTWidgetRidget should implement IMarkableRidget or the cast in MarkerSupport should be made to IBasicMarkableRidget so that both sides fit together.