Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Table not doubleclicked
Table not doubleclicked [message #17504] Thu, 22 January 2009 17:47 Go to next message
Marc is currently offline MarcFriend
Messages: 32
Registered: July 2009
Member
Hi,

I have trouble performing a doubleclick on a Table widget.
bot.table().doubleClick(3, 0);

It behaves just like a "select".
I executed setFocus before the doubleclick, but it does not help.

I'm not sure if it is a bug or not. Has anyone succeded in a double click?

I looked in SWTBotTable.class and it seems ok
in AbstractSWTbot.class I see
protected void doubleClickXY(int x, int y) {
log.debug(MessageFormat.format("Double-clicking on {0}", widget));
notify(SWT.MouseEnter);
notify(SWT.MouseMove);
notify(SWT.Activate);
notify(SWT.FocusIn);
notify(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
notify(SWT.MouseUp);
notify(SWT.Selection);
notify(SWT.MouseDoubleClick, createMouseEvent(x, y, 1, SWT.BUTTON1, 2));
notify(SWT.MouseHover);
notify(SWT.MouseMove);
notify(SWT.MouseExit);
notify(SWT.Deactivate);
notify(SWT.FocusOut);
log.debug(MessageFormat.format("Double-clicked on {0}", widget));
}

I was wondering if it is ok that 2 events are fired?
Re: Table not doubleclicked [message #17625 is a reply to message #17504] Mon, 26 January 2009 14:53 Go to previous messageGo to next message
Marc is currently offline MarcFriend
Messages: 32
Registered: July 2009
Member
Hi,

Finally, it seems not to come from swtbot.
In fact my app has got two object
a table (SWT)
a tableviewer org.eclipse.jface.viewers.TableViewer

The doubleclick listener is set on tableviewer not on the table.

Any idea how I can get swtbot able to simulate a doubleclick on a
Tableviewer?

Thanks in advance
Re: Table not doubleclicked [message #17637 is a reply to message #17625] Mon, 26 January 2009 17:24 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
A TableViewer provides for MVC and uses a Table underneath to display
things.

It is very much possible that SWTBot is broken in this case. There's an
open bug about double clicks on tree items
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=259908), I guess it may
have infestations in a table as well.

-- Ketan


On 26/1/09 20:23, Marc wrote:
> Hi,
>
> Finally, it seems not to come from swtbot.
> In fact my app has got two object
> a table (SWT)
> a tableviewer org.eclipse.jface.viewers.TableViewer
>
> The doubleclick listener is set on tableviewer not on the table.
>
> Any idea how I can get swtbot able to simulate a doubleclick on a
> Tableviewer?
>
> Thanks in advance
>
>
>
Re: Table not doubleclicked [message #21786 is a reply to message #17637] Mon, 16 February 2009 10:01 Go to previous messageGo to next message
Marc is currently offline MarcFriend
Messages: 32
Registered: July 2009
Member
Hi,

I've looked at the bug you mentioned, but I got a bit lost, it doesn't
seem to deal with jface, does it?

I've confirmed my problem:
- an RCP app have a jface TableViewer (with a swt Table attached).
- a doubleclick listener is set on the tableviewer not on the table
- the swtbot "bot.table().doubleClick(x,y)" notifies the table but as no
effect on the tableviewer.

I've confirmed the last point by adding a doubleclick listener directly on
the table, swtbot triggers it well.


I've looked for a work around but found nothing, mainly because I didn't
find any "notifyListeners" like method on jface TatbleViewer.


If someone has an idea on how to programmaticaly fire an double click
event on this TableViewer, I'd be glad to know it.

Thanks
Marc


Ketan Padegaonkar wrote:

> A TableViewer provides for MVC and uses a Table underneath to display
> things.

> It is very much possible that SWTBot is broken in this case. There's an
> open bug about double clicks on tree items
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=259908), I guess it may
> have infestations in a table as well.

> -- Ketan


> On 26/1/09 20:23, Marc wrote:
>> Hi,
>>
>> Finally, it seems not to come from swtbot.
>> In fact my app has got two object
>> a table (SWT)
>> a tableviewer org.eclipse.jface.viewers.TableViewer
>>
>> The doubleclick listener is set on tableviewer not on the table.
>>
>> Any idea how I can get swtbot able to simulate a doubleclick on a
>> Tableviewer?
>>
>> Thanks in advance
>>
>>
>>
Re: Table not doubleclicked [message #21830 is a reply to message #21786] Mon, 16 February 2009 10:25 Go to previous messageGo to next message
hugulas chen is currently offline hugulas chenFriend
Messages: 10
Registered: July 2009
Junior Member
My workaround is
UIThreadRunnable.asyncExec(bot.getDisplay(), new VoidResult() {
public void run() {
table.widget.notifyListeners(SWT.DefaultSelection,
new Event());
}
});
Re: Table not doubleclicked [message #22183 is a reply to message #21830] Mon, 16 February 2009 13:46 Go to previous messageGo to next message
Marc is currently offline MarcFriend
Messages: 32
Registered: July 2009
Member
Hi,

that did not work for me. It could trigger the Table but did nothing on
the TableViewer.

code I use:
bot.table(0).select(3); //to be sure one item is selected
final SWTBotTable theTable;
theTable = bot.table(0);
UIThreadRunnable.asyncExec(bot.getDisplay(), new VoidResult() {
public void run() {
theTable.widget.notifyListeners(SWT.MouseDoubleClick,
new Event());
}
});

Marc

hugulas chen wrote:

> My workaround is
> UIThreadRunnable.asyncExec(bot.getDisplay(), new VoidResult() {
> public void run() {
> table.widget.notifyListeners(SWT.DefaultSelection,
> new Event());
> }
> });
Re: Table not doubleclicked [message #22541 is a reply to message #22183] Tue, 17 February 2009 02:49 Go to previous messageGo to next message
hugulas chen is currently offline hugulas chenFriend
Messages: 10
Registered: July 2009
Junior Member
Hi Marc,

Have you try SWT.DefaultSelection instead of SWT.MouseDoubleClick?
I found my tables and trees are listening the DefaultSelection and
Selection instead of MouseDoubleClick and MouseClick. swtbot does not fire
these events.

Marc wrote:

> Hi,

> that did not work for me. It could trigger the Table but did nothing on
> the TableViewer.

> code I use:
> bot.table(0).select(3); //to be sure one item is selected
> final SWTBotTable theTable;
> theTable = bot.table(0);
> UIThreadRunnable.asyncExec(bot.getDisplay(), new VoidResult() {
> public void run() {
> theTable.widget.notifyListeners(SWT.MouseDoubleClick,
> new Event());
> }
> });

> Marc

> hugulas chen wrote:

>> My workaround is
>> UIThreadRunnable.asyncExec(bot.getDisplay(), new VoidResult() {
>> public void run() {
>> table.widget.notifyListeners(SWT.DefaultSelection,
>> new Event());
>> }
>> });
Re: Table not doubleclicked [message #22585 is a reply to message #22541] Tue, 17 February 2009 08:37 Go to previous messageGo to next message
Marc is currently offline MarcFriend
Messages: 32
Registered: July 2009
Member
Hi,

It worked!
thank you very (!) much.

Sorry I first thought you put DefaultSelection by mistake, and I changed
it to
MouseDoubleClick. Thanks for correcting me.

Is there already a bugzilla about that?
If not, we should create one.

Bye
Marc

hugulas chen wrote:

> Hi Marc,

> Have you try SWT.DefaultSelection instead of SWT.MouseDoubleClick?
> I found my tables and trees are listening the DefaultSelection and
> Selection instead of MouseDoubleClick and MouseClick. swtbot does not fire
> these events.

> Marc wrote:

>> Hi,

>> that did not work for me. It could trigger the Table but did nothing on
>> the TableViewer.

>> code I use:
>> bot.table(0).select(3); //to be sure one item is selected
>> final SWTBotTable theTable;
>> theTable = bot.table(0);
>> UIThreadRunnable.asyncExec(bot.getDisplay(), new VoidResult() {
>> public void run() {
>> theTable.widget.notifyListeners(SWT.MouseDoubleClick,
>> new Event());
>> }
>> });

>> Marc

>> hugulas chen wrote:

>>> My workaround is
>>> UIThreadRunnable.asyncExec(bot.getDisplay(), new VoidResult() {
>>> public void run() {
>>> table.widget.notifyListeners(SWT.DefaultSelection,
>>> new Event());
>>> }
>>> });
Re: Table not doubleclicked [message #22628 is a reply to message #22585] Tue, 17 February 2009 09:44 Go to previous message
Marc is currently offline MarcFriend
Messages: 32
Registered: July 2009
Member
Answering to myself...

http://book.javanb.com/swt-the-standard-widget-toolkit/ch09l ev1sec2.html
I found this page with the following:

9.2.29 Table Events
SWT.DefaultSelection (SelectionEvent)
The SWT.DefaultSelection event (typed event SelectionEvent) is sent
whenever the user performs the platform-specific operation that indicates
default selection. On most platforms, default selection occurs when the
user double-clicks on an item or presses the <Enter> key.

I now see the link with the buzilla Ketan had mentionned:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=259908

Marc
Previous Topic:Toolbar button API does not work consistently
Next Topic:Open perspective
Goto Forum:
  


Current Time: Fri Apr 19 21:56:20 GMT 2024

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

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

Back to the top