Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBotTreeItem.doubleClick() not posting mouse coordinates(How to make doubleClick to post the mouse events)
SWTBotTreeItem.doubleClick() not posting mouse coordinates [message #524619] Thu, 01 April 2010 15:44 Go to next message
Luchesar Cekov is currently offline Luchesar Cekov
Messages: 3
Registered: July 2009
Junior Member
Hi SWTBot gurus,

I am using SWTBotMenuItem to post some doubleClick events to a Tree.

The events got posted correctly but without the mouse coordinates which make impossible to determine which TreeItem the double click was made to.

I took a look at the doubleClick() method in SWTBotMenuItem and it posts event without the mouse coordinates.

public SWTBotTreeItem doubleClick() {
		assertEnabled();
		asyncExec(new VoidResult() {
			public void run() {
				tree.setSelection(widget);
			}
		});
		notifyTree(SWT.Selection);
		notifyTree(SWT.MouseDown);
		notifyTree(SWT.MouseUp);
		notifyTree(SWT.MouseDown);
		notifyTree(SWT.MouseDoubleClick);
		notifyTree(SWT.DefaultSelection);
		notifyTree(SWT.MouseUp);
		return this;
	}


should it not be something like

              int x = cellBounds.x + (cellBounds.width / 2);
               int y = cellBounds.y + (cellBounds.height / 2);
                notifyTree(SWT.Selection);
		notifyTree(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
		notifyTree(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
		notifyTree(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
		notifyTree(SWT.MouseDoubleClick, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
		notifyTree(SWT.DefaultSelection);
		notifyTree(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));


Or is there any other method to get the TreeItem when SWTBot is posting doubleclick events?

Thanks,
Luchesar


Re: SWTBotTreeItem.doubleClick() not posting mouse coordinates [message #524967 is a reply to message #524619] Sun, 04 April 2010 23:01 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf Ebert
Messages: 168
Registered: July 2009
Senior Member
Hi Luchesar,

> int x = cellBounds.x + (cellBounds.width / 2);
> int y = cellBounds.y + (cellBounds.height / 2);
> ...

this sounds like a good and correct fix. Please file a bug for the SWTBot project at
http://bugs.eclipse.org/

You have already created a solution for the problem - do you feel like contributing a
patch that fixes this problem? If so, check out the projects
org.eclipse.swtbot.swt.finder.test and org.eclipse.swtbot.swt.finder, apply your
corrections (great would be to write a unit test that checks for the correct behaviour
first) and use "Team > Create Patch" to create a patch that you can attach to the bug.
Feel free to ask me if you're encountering any problems.

If you don't feel like it, I'll try to do what I can to get this correction into SWTBot.

Greetings,

Ralf

--
http://www.ralfebert.de/blog/
http://twitter.com/ralfebert/
Re: SWTBotTreeItem.doubleClick() not posting mouse coordinates [message #526220 is a reply to message #524967] Fri, 09 April 2010 09:30 Go to previous message
Luchesar Cekov is currently offline Luchesar Cekov
Messages: 3
Registered: July 2009
Junior Member
Filled in bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=308619
Previous Topic:Can SWTBot be used to scrape the Console view?
Next Topic:KeyboardTest & non EN keyboards
Goto Forum:
  


Current Time: Tue Sep 23 04:42:00 GMT 2014

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

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