Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Click on SWTBotToolbarButton - nothing happens
Click on SWTBotToolbarButton - nothing happens [message #482848] Fri, 28 August 2009 06:40 Go to next message
as Missing name is currently offline as Missing name
Messages: 33
Registered: July 2009
Member
Hi,

i have a view with a Tree and want to run an action with
SWTBotToolbarButton(for example: collapse the tree).

I get the button, can click on it, but nothing happens.

Bug ?
Re: Click on SWTBotToolbarButton - nothing happens [message #483327 is a reply to message #482848] Tue, 01 September 2009 03:26 Go to previous messageGo to next message
Benjamin Glaser is currently offline Benjamin Glaser
Messages: 17
Registered: July 2009
Junior Member
Hi Aleksey,

could you show some code?
I tried it some days ago and it worked for me.

Benni
Re: Click on SWTBotToolbarButton - nothing happens [message #483330 is a reply to message #483327] Tue, 01 September 2009 03:39 Go to previous messageGo to next message
as Missing name is currently offline as Missing name
Messages: 33
Registered: July 2009
Member
Hi Benni,

here is the code :

SWTBotView view =
workbenchbot.viewById(IPageLayout.ID_OUTLINE);
SWTBotToolbarButton toolBarButton =
view.toolbarButton(toolTipText);
toolBarButton.click();


Benjamin Glaser schrieb:
> Hi Aleksey,
>
> could you show some code?
> I tried it some days ago and it worked for me.
>
> Benni
>
>
Re: Click on SWTBotToolbarButton - nothing happens [message #483367 is a reply to message #483330] Tue, 01 September 2009 07:31 Go to previous messageGo to next message
Benjamin Glaser is currently offline Benjamin Glaser
Messages: 17
Registered: July 2009
Junior Member
Sorry, but I can't replicate the issue.

SWTBotView view = bot.viewByTitle("title");
SWTBotToolbarButton toolBarButton = view.toolbarButton("tooltip");
toolBarButton.click();

works fine for me.
The Tree collaps as expected.

I used viewbytitle because my testview didn't have an ID so far.
But I don't think this will change a lot.

You don't get any exceptions?
It just don't happens anything?

Pretty weird...
Re: Click on SWTBotToolbarButton - nothing happens [message #483655 is a reply to message #483367] Wed, 02 September 2009 09:38 Go to previous messageGo to next message
as Missing name is currently offline as Missing name
Messages: 33
Registered: July 2009
Member
Benjamin Glaser schrieb:
> Sorry, but I can't replicate the issue.
>
> SWTBotView view = bot.viewByTitle("title");
> SWTBotToolbarButton toolBarButton = view.toolbarButton("tooltip");
> toolBarButton.click();
>
> works fine for me.
> The Tree collaps as expected.
>
> I used viewbytitle because my testview didn't have an ID so far.
> But I don't think this will change a lot.
>
> You don't get any exceptions?
> It just don't happens anything?
>
> Pretty weird...
>
>
>
>

The run-Method of the action is called, but isChecked() returns always
false ...

As a consequence the implementation assumes that the action is not
enabled and can not add a filter(ViewerFilter) to the tree => no change
in the tree...
Re: Click on SWTBotToolbarButton - nothing happens [message #483687 is a reply to message #483655] Wed, 02 September 2009 11:04 Go to previous messageGo to next message
as Missing name is currently offline as Missing name
Messages: 33
Registered: July 2009
Member
Aleksey Shumilin schrieb:
> Benjamin Glaser schrieb:
>> Sorry, but I can't replicate the issue.
>>
>> SWTBotView view = bot.viewByTitle("title");
>> SWTBotToolbarButton toolBarButton = view.toolbarButton("tooltip");
>> toolBarButton.click();
>>
>> works fine for me.
>> The Tree collaps as expected.
>>
>> I used viewbytitle because my testview didn't have an ID so far.
>> But I don't think this will change a lot.
>>
>> You don't get any exceptions?
>> It just don't happens anything?
>>
>> Pretty weird...
>>
>>
>>
>>
>
> The run-Method of the action is called, but isChecked() returns always
> false ...
>
> As a consequence the implementation assumes that the action is not
> enabled and can not add a filter(ViewerFilter) to the tree => no change
> in the tree...

.... could be an OS-problem ? (i have ubuntu)
Re: Click on SWTBotToolbarButton - nothing happens [message #483711 is a reply to message #483687] Wed, 02 September 2009 11:46 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Aleksey Shumilin wrote:
> Aleksey Shumilin schrieb:
>> Benjamin Glaser schrieb:
>>> Sorry, but I can't replicate the issue.
>>>
>>> SWTBotView view = bot.viewByTitle("title");
>>> SWTBotToolbarButton toolBarButton =
>>> view.toolbarButton("tooltip");
>>> toolBarButton.click();
>>>
>>> works fine for me.
>>> The Tree collaps as expected.
>>>
>>> I used viewbytitle because my testview didn't have an ID so far.
>>> But I don't think this will change a lot.
>>>
>>> You don't get any exceptions?
>>> It just don't happens anything?
>>>
>>> Pretty weird...
>>>
>>>
>>>
>>>
>>
>> The run-Method of the action is called, but isChecked() returns always
>> false ...
>>
>> As a consequence the implementation assumes that the action is not
>> enabled and can not add a filter(ViewerFilter) to the tree => no
>> change in the tree...
>
> ... could be an OS-problem ? (i have ubuntu)
I don't think it's an OS problem. The SWTBotToolbarButton doesn't set
the checked status of the button, you should instead use a
SWTBotToolbarCheckboxButton, like this:

SWTBotView view = bot.viewByTitle("title");
SWTBotToolbarButton toolBarButton =
view.bot().toolbarToggleButton("tooltip");
toolBarButton.click();

I think this should work now. Or maybe not, I don't know if the bot will
search in the global toolbar or the views toolbar. Give it a try and
we'll know.

Another way would be:

SWTBotView view = bot.viewByTitle("title");
SWTBotToolbarButton toolBarButton = view.toolbarButton("tooltip");
new SWTBotToolbarCheckboxButton(toolBarButton.widget).click();

I'm pretty sure this one will work, althought it looks clumsy to me...

--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: Click on SWTBotToolbarButton - nothing happens [message #483712 is a reply to message #483711] Wed, 02 September 2009 12:06 Go to previous messageGo to next message
as Missing name is currently offline as Missing name
Messages: 33
Registered: July 2009
Member
Pascal Gelinas schrieb:
> Aleksey Shumilin wrote:
>> Aleksey Shumilin schrieb:
>>> Benjamin Glaser schrieb:
>>>> Sorry, but I can't replicate the issue.
>>>>
>>>> SWTBotView view = bot.viewByTitle("title");
>>>> SWTBotToolbarButton toolBarButton =
>>>> view.toolbarButton("tooltip");
>>>> toolBarButton.click();
>>>>
>>>> works fine for me.
>>>> The Tree collaps as expected.
>>>>
>>>> I used viewbytitle because my testview didn't have an ID so far.
>>>> But I don't think this will change a lot.
>>>>
>>>> You don't get any exceptions?
>>>> It just don't happens anything?
>>>>
>>>> Pretty weird...
>>>>
>>>>
>>>>
>>>>
>>>
>>> The run-Method of the action is called, but isChecked() returns always
>>> false ...
>>>
>>> As a consequence the implementation assumes that the action is not
>>> enabled and can not add a filter(ViewerFilter) to the tree => no
>>> change in the tree...
>>
>> ... could be an OS-problem ? (i have ubuntu)
> I don't think it's an OS problem. The SWTBotToolbarButton doesn't set
> the checked status of the button, you should instead use a
> SWTBotToolbarCheckboxButton, like this:
>
> SWTBotView view = bot.viewByTitle("title");
> SWTBotToolbarButton toolBarButton =
> view.bot().toolbarToggleButton("tooltip");
> toolBarButton.click();
>
> I think this should work now. Or maybe not, I don't know if the bot will
> search in the global toolbar or the views toolbar. Give it a try and
> we'll know.
>
> Another way would be:
>
> SWTBotView view = bot.viewByTitle("title");
> SWTBotToolbarButton toolBarButton = view.toolbarButton("tooltip");
> new SWTBotToolbarCheckboxButton(toolBarButton.widget).click();
>
> I'm pretty sure this one will work, althought it looks clumsy to me...
>

thank you Pascal, the second way works fine!
Re: Click on SWTBotToolbarButton - nothing happens [message #483855 is a reply to message #483655] Thu, 03 September 2009 07:49 Go to previous messageGo to next message
Benjamin Glaser is currently offline Benjamin Glaser
Messages: 17
Registered: July 2009
Junior Member
Well, you never mentioned that you want to click on an toggleButton.
"colapseAll" isn't a toggleButton.

Have a closer look at: https://bugs.eclipse.org/bugs/show_bug.cgi?id=282982
Re: Click on SWTBotToolbarButton - nothing happens [message #484071 is a reply to message #483855] Fri, 04 September 2009 04:04 Go to previous message
as Missing name is currently offline as Missing name
Messages: 33
Registered: July 2009
Member
Benjamin Glaser schrieb:
> Well, you never mentioned that you want to click on an toggleButton.
> "colapseAll" isn't a toggleButton.
>
> Have a closer look at: https://bugs.eclipse.org/bugs/show_bug.cgi?id=282982
>


depends on the the implementation of the "collapseAll" action(i have my
own) :-)
sorry, was my fault ...
Previous Topic:Bugfixing of local swtbot plugins
Next Topic:Wait for progressmonitordialog close
Goto Forum:
  


Current Time: Thu Jul 31 23:47:54 EDT 2014

Powered by FUDForum. Page generated in 0.01950 seconds