Community
Participate
Working Groups
Description copied from http://swtbot.org/bugzilla/show_bug.cgi?id=106: Example Unit Test showing doubleClick not working SWTBotTreeItem.doubleClick() should bring up an editor when using it on a Java File from the Package Explorer view, but it does not. Attached Unit test is the example test I was writing that doesn’t work.
Created attachment 122869 [details] the patch for the fix
Created attachment 122870 [details] mylyn/context/zip
Created attachment 122871 [details] test case
Kevin, Found the fix, can you confirm that this patch works for you ? There's a minor change in the MenuFinder as a workaround for the recursive context menu being broken(bug 261360).
I had to change back the MenuFinder line to be false instead of true or else the test case would fail on the first line to open the new java project wizard. After that the patch works for the test case, however I extended the testcase with: editor.close(); try { bot.activeEditor(); fail("Active Editor found."); } catch (Exception e) { } view.setFocus(); item = tree.getTreeItem(PROJECT_NAME).getNode("src"); item.doubleClick(); Thread.sleep(10000); Since there is no api to check expanded state I have the 10 seconds sleep, so I can visually check for now. I saw that the src folder wasn't being expanded. I changed the order around for doubleClick a bit to be: assertEnabled(); syncExec(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; With this change the src folder is collapsed.
Also to get around using the context menu bug I am using File -> New -> Class to create the class: bot.menu("File").menu("New").menu("Class").click();
This is a more general problem with how clicking a node in SWT Tree works...see this bug: http://swtbot.org/bugzilla/show_bug.cgi?id=133 I think better general solution would be to modify how click works then the double click method. (In reply to comment #4) > Kevin, > > Found the fix, can you confirm that this patch works for you ? There's a minor > change in the MenuFinder as a workaround for the recursive context menu being > broken(bug 261360). >
I just ran across this issue also. Adding myself to the CC list so that I can get an updated SWTBot once this is fixed.
I have also encounter this problem.Add me to cc list.
Hi, Here is what I've come to about doubleclick issue. It is about a table but it's probably the same for tree. I tell it in case it might help. I had a TableViewer with Table. A IDoubleClicListener is set on TableViewer No direct listener on the Table. Sending the SWT.mouseDoubleclick event to the the Table had no effect (it has one only if a double click listener is set on the Table) Sending the SWT.DefaultSelection triggers the IDoubleClicListener. (thanks hugulas chen for this tip) So my point of vue is that the IDoubleClikListeners does not listen to double clics (!). It listens to "platform-dependent way of validating in a table"... which happens with a double click or press enter most of the time. Each platform probably catch a real double clic and silently translate it to SWT.defaultSelection. What we do not do by sending SWT.MouseDoubleClick. Hope this helps
Confirming this issue with 2.0.0.204-dev. Given the following code in a view: tableViewer.addDoubleClickListener(...open some editor...) Executing bot.table(0).doubleClick(0, 0) results in the first row being selected, but no editor is opened!
Adding a dependency on bug 271132. bug 271132 should solve this long pending issue.
Also I'm following this issue.
Just voicing my +1 here. Was sad to see doubleClick not work on a simple table (selected the item, caused no double-click)
The problem with TreeItem.doubleClick seems to be already solved. Pushed patch to gerrit that sends SWT.DefaultSelection for Table.doubeClick. This should fix the table problem. https://git.eclipse.org/r/19471 (In reply to Marc from comment #10) > Sending the SWT.DefaultSelection triggers the IDoubleClicListener. > (thanks hugulas chen for this tip) >
Kristine's patch works well with good quality, so it got merged. Thanks.