Skip to main content



      Home
Home » Eclipse Projects » SWTBot » Replacement for deprecated SWTBotView.menus method?(deprecated SWTBotViewMenu)
Replacement for deprecated SWTBotView.menus method? [message #1731432] Thu, 05 May 2016 04:20 Go to next message
Eclipse UserFriend
I'm using swtbot's latest snapshot build in which SWTBotViewMenu have been deprecated. I replaced my old calls to view menu with SWTBotView.viewMenu.
But I am not finding replacement for SWTBotView.menus method which returns a list of all menus.
Please tell me the way to replace it in new recommanded way.
Thanks
Re: Replacement for deprecated SWTBotView.menus method? [message #1731464 is a reply to message #1731432] Thu, 05 May 2016 11:38 Go to previous messageGo to next message
Eclipse UserFriend
The reason the method was deprecated from the view menu (and not available either for other types of menus) is that, especially with recursive and dynamic menus, we could not ensure that the MenuItem widget (owned by the returned instances of SWTBotMenu) has not been disposed. It could cause exceptions if you tried to use a menu item that belongs to a sub-menu that has been hidden while searching through other sub-menus.

If you want to verify that the view menu contains an explicit list of menu items, you could use the following:

swtBotView.viewMenu("Item 1");
swtBotView.viewMenu("Item 2");


This does not validate the order however. If order is important you could use the following instead:

assertEquals("Item 1", swtBotView.viewMenu().menu(widgetOfType(MenuItem.class), true, 0).getText());
assertEquals("Item 2", swtBotView.viewMenu().menu(widgetOfType(MenuItem.class), true, 1).getText());


Re: Replacement for deprecated SWTBotView.menus method? [message #1731473 is a reply to message #1731464] Thu, 05 May 2016 15:54 Go to previous message
Eclipse UserFriend
Thanks Patrick!
Previous Topic:How to click on Message dilogue "OK" Button
Next Topic:Recorder/Generator for non RCP app
Goto Forum:
  


Current Time: Thu May 22 22:57:59 EDT 2025

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

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

Back to the top