Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Triggering a mouse hover event on a toolbar item
Triggering a mouse hover event on a toolbar item [message #1854013] Wed, 27 July 2022 19:46
Frederic Bard is currently offline Frederic BardFriend
Messages: 6
Registered: August 2020
Junior Member
I have an RCP app for which I am using SWTBot to implement UI tests.
I have a particular use case that I can't seem to be able to generate tests for.

I have a view that contains several items in its toolbar. One of them reacts to a mouse hover event only and I haven't found a way yet to trigger a mouse hover event in SWTBot for this particular toolbar item.

Any ideas how to do that ?
Here is my attempt so far that results in the below exception:

    final IToolBarManager items = mySwtBotView.getViewReference().getView(false).getViewSite().getActionBars().getToolBarManager();
          for (final IContributionItem item : items.getItems()) {
                final Widget widget = (Widget) item;
                widget.notifyListeners(SWT.MouseHover, null);

java.lang.ClassCastException: class MyToolbarAction cannot be cast to class org.eclipse.swt.widgets.Widget (class MyToolbarAction is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @68aa43bb;

Thanks in advance

[Updated on: Thu, 28 July 2022 22:42]

Report message to a moderator

Previous Topic:Migration to SLF4J logging in SWTBot 4.0
Next Topic:Can't access right-click menu items of project that have sub-menus
Goto Forum:

Current Time: Fri Apr 19 03:58:18 GMT 2024

Powered by FUDForum. Page generated in 0.02083 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top