Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to use context menus that are created dynamically?
How to use context menus that are created dynamically? [message #756336] Sat, 12 November 2011 03:19 Go to next message
Geoff Bache is currently offline Geoff Bache
Messages: 33
Registered: October 2010
Member
Hi all,

I wonder what is the expected way to click on menus that are created like this:

button.addListener(SWT.MenuDetect, new Listener(){
public void handleEvent(Event e){
Menu menu = new Menu(...);
...
}
});

The ContextMenuFinder doesn't find them of course, because they don't exist until the widget is right-clicked. There are various rightClick methods around but they seem to be protected.

Regards,
Geoff Bache
Re: How to use context menus that are created dynamically? [message #756472 is a reply to message #756336] Sun, 13 November 2011 14:13 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
I don't think this is doable with the currently implementation of SWTBot.

you can override SWTBot#contextMenu with your own implementation of
ContextMenuFinder if it works for you.

-- Ketan

On 11/12/11 12:19 AM, Geoff Bache wrote:
> Hi all,
>
> I wonder what is the expected way to click on menus that are created
> like this:
>
> button.addListener(SWT.MenuDetect, new Listener(){
> public void handleEvent(Event e){
> Menu menu = new Menu(...);
> ...
> }
> });
>
> The ContextMenuFinder doesn't find them of course, because they don't
> exist until the widget is right-clicked. There are various rightClick
> methods around but they seem to be protected.
>
> Regards,
> Geoff Bache
>
Re: How to use context menus that are created dynamically? [message #758075 is a reply to message #756336] Mon, 21 November 2011 15:39 Go to previous message
Geoff Bache is currently offline Geoff Bache
Messages: 33
Registered: October 2010
Member
Thanks Ketan.

I'm heading down the route of suggesting code changes in the SUT, with a link to this thread as backup Smile

Regards,
Geoff
Previous Topic:Can't access some buttons in eclipse
Next Topic:Is there anyway to run my rcp tests from the commandline
Goto Forum:
  


Current Time: Sat Jul 26 05:28:25 EDT 2014

Powered by FUDForum. Page generated in 0.02331 seconds