SWTBotTreeItem's context menu click gives TimeoutException [message #1416063] |
Thu, 04 September 2014 04:50  |
Eclipse User |
|
|
|
I was using swtbot 2.0.5. Recently I've started using swtbot 2.2.2 on eclipse 4.4.
I observed that SWTBotTreeItem's contextmenu click is giving TimeoutException.
My test-snippet is very simple-
SWTBotTreeItem ti = bot().tree().getTreeItem("i");
ti.contextMenu("Disable").click();
Here I'm getting 'SWTBotTreeItem ti' correctly. It's context menu 'Disable' is enabled in UI.
org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 5000 ms.: Could not find context menu with text 'Disable'
Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument:Action must not be null
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
at org.eclipse.jface.action.ContributionManager.add(ContributionManager.java:76)
at org.eclipse.debug.internal.ui.views.expression.ExpressionView.fillContextMenu(ExpressionView.java:89)
Has anyone faced such problem?
|
|
|
|
|
|
|
|
|
|
Re: SWTBotTreeItem's context menu click gives TimeoutException [message #1471762 is a reply to message #1429440] |
Thu, 13 November 2014 05:06  |
Eclipse User |
|
|
|
It seems I found how to make it work!
Actually the problem was caused due to not finding entry in fActionMap upon FocusLost event, which gets called as a result of SWTBotTreeItem.notifySelect().
If I comment out the line which sends SWT.FocusOut event in SWTBotTreeItem.notifySelect() method, then context menu click happens without any problem. UI also gets updated, as expected.
After commenting out this line, FocusLost routine of VariablesView in eclipse is not called and hence the globalActions (e.g. 'find' action) is not removed. Therefore, fActionMap gets entry for 'find' action in fillContextMenu() method of VariablesView and the further code also executes well.
Is this solution okay? Will it have any side-effects?
Please share your thoughts.
I've one more question--
If I compare implementation of notifySelect() method of SWTBotTableItem and SWTBotTreeItem, I see that-
SWTBotTableItem sends only SWT.Selection and SWTBotTreeItem sends a series of SWT events like MouseEnter, MouseMove, Activate, FocusIn and so on.
Are all these events required?
If I comment-out all events and keep only SWT.Selection in SWTBotTreeItem.notifySelect(), then also context menu click happens okay.
Is SWT.Selection alone not sufficient?
I'm not able to figure out the need for each event here. It would be very helpful if somebody explains it.
Thanks..
Aparna
|
|
|
Powered by
FUDForum. Page generated in 0.03426 seconds