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

Bug 338002

Summary: ClassCastException in AbstractSWTBot while selecting menu items from SWTBotToolbarDropDownButton.
Product: [Technology] SWTBot Reporter: Randy Fredrick <rjfredrick>
Component: EclipseBotAssignee: Project Inbox <swtbot-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: mariot.chauvin, rjfredrick
Version: 2.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Randy Fredrick CLA 2011-02-23 13:02:40 EST
Build Identifier: Build id: M20100909-0800

Stack Trace 1:
Thread [main] (Suspended (exception ClassCastException))	
CCombo$3.handleEvent(Event) line: 145	
EventTable.sendEvent(Event) line: 84	
Display.filterEvent(Event) line: 1253	
ToolItem(Widget).sendEvent(Event) line: 1052	
ToolItem(Widget).sendEvent(int, Event, boolean) line: 1077	
ToolItem(Widget).sendEvent(int, Event) line: 1062	
ToolItem(Widget).notifyListeners(int, Event) line: 774	
AbstractSWTBot$2.run() line: 158	
UIThreadRunnable$5.doRun() line: 221	
UIThreadRunnable$1.run() line: 89

Stack Trace 2:
Thread [WorkbenchTestable] (Suspended)	
Object.wait(long) line: not available [native method]	
RunnableLock(Object).wait() line: 485	
UISynchronizer(Synchronizer).syncExec(Runnable) line: 186	
UISynchronizer.syncExec(Runnable) line: 150	
Display.syncExec(Runnable) line: 4584	
UIThreadRunnable$4(UIThreadRunnable).run() line: 76	
UIThreadRunnable.syncExec(Display, VoidResult) line: 198	
UIThreadRunnable.syncExec(VoidResult) line: 183	
SWTBotToolbarDropDownButton(AbstractSWTBot<T>).notify(int, Event, Widget) line: 163	
SWTBotToolbarDropDownButton(AbstractSWTBot<T>).notify(int, Event) line: 128	
SWTBotToolbarDropDownButton(AbstractSWTBot<T>).notify(int) line: 118	
SWTBotToolbarDropDownButton.menuItems(Matcher<MenuItem>) line: 116	
SWTBotToolbarDropDownButton.menuItem(Matcher<MenuItem>) line: 94	
SWTBotToolbarDropDownButton.menuItem(String) line: 81

Reproducible: Always

Steps to Reproduce:
1. Create a CCombo.
2. Add a ToolBar (SWT.FLAT | SWT.NO_FOCUS)
3. Add a ToolItem to the ToolBar (SWT.DROP_DOWN) and set ToolTipText.
4. Add Selection Listener to ToolItem that displays a menu when selected.
5. SWTBotToolbarDropDownButton toolbarButton = toolbarDropDownButtonWithTooltip("Your ToolTip");
6. SWTBotMenu menuItem = toolbarButton.menuItem("Your Menu Item");
Comment 1 Mariot Chauvin CLA 2011-09-21 11:02:50 EDT
I don't think there is not any issue coming from SWTBot in the problem you reported. SWT CCombo implementation cast widget source of the event as Control without checking the type. I don't see why the code assume this cast is safe.

I think that you report the bug to the SWT Team.

Please reopen if I miss something.