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

Bug 496349

Summary: ClassCastException in ControlThemeAdapterImpl: ToolItem cannot be cast to Control
Product: [RT] RAP Reporter: Tobias Hofer <tobias.hofer>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: ivan
Version: 3.1   
Target Milestone: 3.2 M1   
Hardware: All   
OS: Linux   
See Also: https://git.eclipse.org/r/#/c/75538/
Whiteboard: sr311

Description Tobias Hofer CLA 2016-06-18 18:30:26 EDT
Caused by: java.lang.ClassCastException: org.eclipse.swt.widgets.ToolItem cannot be cast to org.eclipse.swt.widgets.Control
	at org.eclipse.swt.internal.widgets.controlkit.ControlThemeAdapterImpl$1.matches(ControlThemeAdapterImpl.java:34)
	at org.eclipse.rap.rwt.internal.theme.WidgetMatcher.matches(WidgetMatcher.java:61)
	at org.eclipse.rap.rwt.internal.theme.WidgetMatcher.select(WidgetMatcher.java:51)
	at org.eclipse.rap.rwt.internal.theme.ThemeUtil.getCssValue(ThemeUtil.java:149)
	at org.eclipse.rap.rwt.internal.theme.ThemeUtil.getCssValue(ThemeUtil.java:137)
	at org.eclipse.rap.rwt.internal.theme.ThemeAdapter.getCssBorderWidth(ThemeAdapter.java:74)
	at org.eclipse.rap.rwt.internal.theme.ThemeAdapter.getCssBorder(ThemeAdapter.java:66)
	at org.eclipse.swt.internal.widgets.toolbarkit.ToolBarThemeAdapter.getItemBorder(ToolBarThemeAdapter.java:36)
	at org.eclipse.swt.widgets.ToolItem.getBorder(ToolItem.java:638)
	at org.eclipse.swt.widgets.ToolItem.getFrameWidth(ToolItem.java:626)
	at org.eclipse.swt.widgets.ToolItem.getPreferredWidth(ToolItem.java:621)
	at org.eclipse.swt.widgets.ToolItem.getWidth(ToolItem.java:574)
	at org.eclipse.swt.widgets.ToolItem.getBounds(ToolItem.java:496)
	at org.eclipse.swt.widgets.ToolBar.layoutItems(ToolBar.java:385)
	at org.eclipse.swt.widgets.ToolItem.setImage(ToolItem.java:211)
Comment 1 Ivan Furnadjiev CLA 2016-06-20 03:54:44 EDT
I can reproduce it with our Controls Demo -> ToolBar Tab and modified default theme (added ToolItem:disabled{border: 1px solid red;}). As a temporary workaround, please remove from your theme the styling for disabled ToolItem.
Comment 2 Ivan Furnadjiev CLA 2016-06-20 04:51:02 EDT
Pending fix: https://git.eclipse.org/r/#/c/75538/
Comment 3 Ivan Furnadjiev CLA 2016-06-21 05:42:51 EDT
Fixed in master with change https://git.eclipse.org/r/#/c/75538/
Comment 4 Ivan Furnadjiev CLA 2016-08-31 02:53:08 EDT
Backported to 3.1-maintenance branch.