Skip to main content



      Home
Home » Eclipse Projects » Sirius » [SWTBotTest] How to retrieve/check exists of a context menu
[SWTBotTest] How to retrieve/check exists of a context menu [message #1597141] Sun, 01 February 2015 23:56 Go to next message
Eclipse UserFriend
Hello,

I wrote a test to check an context menu not available as expected.

I've found no api support it. What i can do is using try..catch(WidgetNotFoundException) which is not a good solution since it take time till timeout happen, increase test time execution.

Do we have better answer for the issue?

Thanks.

Thanh Huy LE

[Updated on: Mon, 02 February 2015 00:57] by Moderator

Re: [SWTBotTest] How to retrieve/check exists of a context menu [message #1602484 is a reply to message #1597141] Thu, 05 February 2015 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I think that you could do that by modifying a little the service
SWTBotUtils.hasContextMenu(...).
In this service there is a call to swtBotContextMenu.exist(). This one
has a waiting condition on the menu item, that execute this test:
items.addAll(menuFinder.findMenus(matcher));
return !items.isEmpty();
You can try to have the same test but without the waiting condition.

Regards,
Steve


Le 02/02/2015 05:56, Huy Le a écrit :
> Hello,
>
> I wrote a test to check an context menu not available as expected.
>
> I've found any api support it. What i can do is using
> try..catch(WidgetNotFoundException) which is not a good solution since
> it take time till timeout happen, increase test time execution.
>
> Do we have better answer for the issue?
>
> Thanks.
>
> Thanh Huy LE


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: [SWTBotTest] How to retrieve/check exists of a context menu [message #1607974 is a reply to message #1602484] Mon, 09 February 2015 02:24 Go to previous messageGo to next message
Eclipse UserFriend
Thanks,

However, SWTBotUtils.hasContextMenu() applied to TreeItem. The method requires two objects: Display and Control where we can retrieve them by call treeItem.display and treeItem.widget.getParent()

How can we do same thing via SWTBotGefEditor when a node selected?

As I know, editor.getWidget().getDisplay() return Display. What proper method return the Control?

(I expect editor.getSWTBotGefViewer().getControl() but the method is protected)

Thanh Huy LE





Re: [SWTBotTest] How to retrieve/check exists of a context menu [message #1610020 is a reply to message #1607974] Tue, 10 February 2015 08:51 Go to previous message
Eclipse UserFriend
Hello,

To access the Control using the SWTBotGetEditor, you need to recover the
EditPart of the Diagram and then its viewer. Therefore you should use
the following expression:
editor.getDiagramEditPart().getViewer().getControl().

Regards,
Steve

Le 09/02/2015 08:24, Huy Le a écrit :
> Thanks,
>
> However, SWTBotUtils.hasContextMenu() applied to TreeItem. The method
> requires two objects: Display and Control where we can retrieve them by
> call treeItem.display and treeItem.widget.getParent()
>
> How can we do same thing via SWTBotGefEditor when a node selected?
> As I know, editor.getWidget().getDisplay() return Display. What proper
> method return the Control?
>
> (I expect editor.getSWTBotGefViewer().getControl() but the method is
> protected)
>
> Thanh Huy LE
>
>
>
>
>
>


--
Steve Monnier - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Navigate Different Metamodels
Next Topic:Disable vertical reordering of executions nodes in Sequence diagram representations
Goto Forum:
  


Current Time: Thu May 15 19:54:02 EDT 2025

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

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

Back to the top