Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Accessing "View Menu"?
Accessing "View Menu"? [message #536684] Sat, 29 May 2010 20:05 Go to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
I need help accessing the "View Menu", the triangle icon next to the
minimize and maximize icons. I need to be able to test things like
presence of menu items and to click them to confirm their action. An
example would be great.

Thanks,
Craig
Re: Accessing "View Menu"? [message #537149 is a reply to message #536684] Tue, 01 June 2010 13:10 Go to previous messageGo to next message
Etienne  is currently offline Etienne Friend
Messages: 13
Registered: July 2009
Junior Member
Hi,

[bot].viewByTitle("your view").menu("label in the menu").click();

An exception is thrown if the "label in the menu" doesn't exists.

Etienne

Le 29/05/2010 22:05, Craig Foote a écrit :
> I need help accessing the "View Menu", the triangle icon next to the
> minimize and maximize icons. I need to be able to test things like
> presence of menu items and to click them to confirm their action. An
> example would be great.
>
> Thanks,
> Craig
Re: Accessing "View Menu"? [message #537322 is a reply to message #537149] Tue, 01 June 2010 23:50 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
For a negative test (where any widget does not exist):

try{
bot.view().menu("whatever");
}catch (WidgetNotFoundException e){ }

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot

On 6/1/10 6:40 PM, Etienne wrote:
> Hi,
>
> [bot].viewByTitle("your view").menu("label in the menu").click();
>
> An exception is thrown if the "label in the menu" doesn't exists.
>
> Etienne
>
> Le 29/05/2010 22:05, Craig Foote a écrit :
>> I need help accessing the "View Menu", the triangle icon next to the
>> minimize and maximize icons. I need to be able to test things like
>> presence of menu items and to click them to confirm their action. An
>> example would be great.
>>
>> Thanks,
>> Craig
>
Re: Accessing "View Menu"? [message #538532 is a reply to message #536684] Mon, 07 June 2010 21:29 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
Thanks for replying but this is still not working for me. I've debugged through to ViewMenuFinder#getMenuItemsInternal where it iterates over the menu items looking for the match. Its two checks for MenuManager and ActionContributionItem both fail so my menu item is not found. My item is in the list iterated over but it is a SubContributionItem with an "innerItem" that is the sought ActionContributionItem.

If it helps, the menu item I'm looking for is an Action contributed to the PropertySheet via a custom IPropertySheetPage implementation's #setActionBars. That method is provided an IActionBars from which I get the IMenuManager to which I add the Action.

I'm wondering if the nature of PageBooks and how they contribute to the host view's menu is a factor here. Either way, I can't see how that method can return my menu item as is. So I guess either I'm doing something really wrong or I've found a bug.

Any ideas greatly appreciated.

Craig
Re: Accessing "View Menu"? [message #538570 is a reply to message #538532] Tue, 08 June 2010 02:46 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 6/8/10 2:59 AM, Craig Foote wrote:
> Thanks for replying but this is still not working for me. I've debugged
> through to ViewMenuFinder#getMenuItemsInternal where it iterates over
> the menu items looking for the match. Its two checks for MenuManager and
> ActionContributionItem both fail so my menu item is not found. My item
> is in the list iterated over but it is a SubContributionItem with an
> "innerItem" that is the sought ActionContributionItem.

Could you write a small snippet in the SWTBot tests[1] to reproduce this
? It'd be of great help for me to implement what's missing.

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot

[1] - http://goo.gl/wOin
Re: Accessing "View Menu"? [message #538574 is a reply to message #538570] Tue, 08 June 2010 03:32 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
Sure, what's the "SWTBot tests[1]"?
Re: Accessing "View Menu"? [message #540115 is a reply to message #538574] Tue, 15 June 2010 01:39 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
On Mon, 07 Jun 2010 23:32:12 -0400, Craig Foote wrote:

> Sure, what's the "SWTBot tests[1]"?

bump
Re: Accessing "View Menu"? [message #540266 is a reply to message #540115] Tue, 15 June 2010 13:41 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
On 10-06-14 09:39 PM, Craig Foote wrote:
> On Mon, 07 Jun 2010 23:32:12 -0400, Craig Foote wrote:
>
>> Sure, what's the "SWTBot tests[1]"?
>
> bump

[1] - http://goo.gl/wOin

It was hidden in Ketan's signature :P
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
icon10.gif  Re: Accessing "View Menu"? [message #540386 is a reply to message #540266] Tue, 15 June 2010 23:42 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
D'oh! Sorry about that. I'm new to git so this might take a while. I assume I do a fork to create my own repo and somehow push back to you?
Re: Accessing "View Menu"? [message #540388 is a reply to message #540386] Tue, 15 June 2010 23:56 Go to previous message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 6/15/10 4:42 PM, Craig Foote wrote:
> D'oh! Sorry about that. I'm new to git so this might take a while. I
> assume I do a fork to create my own repo and somehow push back to you?

In case you're not comfortable with git, you can use SVN instead.

See http://wiki.eclipse.org/SWTBot/Contributing

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Previous Topic:...\plugins\org.eclipse.test\JUNIT.XSL doesn't exist
Next Topic:How to insert text into a text editor tab of a multipage editor?
Goto Forum:
  


Current Time: Wed Apr 24 23:38:39 GMT 2024

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

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

Back to the top