Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:20 Go to next message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 60
Registered: October 2010
Member
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 15:38 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
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 19:54 Go to previous message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 60
Registered: October 2010
Member
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 Apr 25 10:22:29 GMT 2024

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

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

Back to the top