Table not doubleclicked [message #17504] |
Thu, 22 January 2009 12:47  |
Eclipse User |
|
|
|
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 #21786 is a reply to message #17637] |
Mon, 16 February 2009 05:01   |
Eclipse User |
|
|
|
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 #22585 is a reply to message #22541] |
Tue, 17 February 2009 03:37   |
Eclipse User |
|
|
|
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());
>>> }
>>> });
|
|
|
|
Powered by
FUDForum. Page generated in 0.03575 seconds