Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Sometimes SWTBotTable.select sends event.item=Null in SelectionEvent
Sometimes SWTBotTable.select sends event.item=Null in SelectionEvent [message #1749167] Fri, 02 December 2016 14:59 Go to next message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 44
Registered: October 2010
Member
If we do SWTBotTable.select(int) as the first operation on the table, it gives event.item as Null in the selectionEvent caused due to unselect().

Here is the flow-
table.select(int) calls unselect() which then calls selectionEvent().
Here lastSelectionItem is yet uninitialized, so event.item is set to null. notifySelect() then sends item=null to notify Selection event.
Suppose if the application implements widgetSelected(SelectionEvent e), then it gets event.item=null.
Later in the SWTBotTable.select, selection happens.

How about checking null condition at SWTBotTable's line 333 ?
if(lastSelectionItem != null)
unselect();

This way, unnecessary events will not get triggered and also the application will not get null item in selectionEvent.
Re: Sometimes SWTBotTable.select sends event.item=Null in SelectionEvent [message #1749340 is a reply to message #1749167] Mon, 05 December 2016 16:36 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 54
Registered: July 2009
Member
Hi Aparna,

Thanks for reporting this. It doesn't seem like SWTBot is behaving like a real SWT application.

What I see testing with real user actions is that there shouldn't be any SelectionEvent at all sent to the previously selected item when you select a new one.

The only time that a SelectionEvent is sent to an unselected event is when you specifically unselect it (e.g. Ctrl+click or Ctrl+space) and this is only possible if the table has SWT.MULTI style, you can't unselect when the table is SWT.SINGLE.

Also the unselect() method unselects all, presumably if it is a SWT.MULTI table with many selected items, you would have to either unselect each item one by one, or select one item and then unselect it. The method now unselects all items then sends only one selection event. The method also doesn't check that it's a SWT.MULTI table.

SWTBotTree also has the same issues, even more, it doesn't set the event.item at all on selection.

So there's a few bugs here, would like to open a bug report?

Thanks,
Patrick
Re: Sometimes SWTBotTable.select sends event.item=Null in SelectionEvent [message #1749344 is a reply to message #1749340] Mon, 05 December 2016 17:26 Go to previous message
Aparna Argade is currently offline Aparna ArgadeFriend
Messages: 44
Registered: October 2010
Member
Thanks Patrick for the detailed response.
I also had all these thoughts in mind and will open a bug with all these points.
Previous Topic:Not able to access table view
Next Topic:Can't add Required plug-ins to MANIFEST.MF
Goto Forum:
  


Current Time: Sun Sep 23 21:30:54 GMT 2018

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

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

Back to the top