Using the default eclipse project explorer this worked fine for both Open 
With>Java Editor style menus and normal ones. So must be something 
specific I'm doing in the custom package explorer for the RCP app i'm 
working on. Thanks for the help i'll keep digging around

Thanks

-Curtis





Ketan Padegaonkar <[EMAIL PROTECTED]> 
04/10/2008 23:11
Please respond to
swtbot-users@lists.sourceforge.net


To
swtbot-users@lists.sourceforge.net
cc

Subject
Re: [SWTBot-users] ContextMenu disposed when try to click






Curtis,

I think a similar issue was reported sometime ago. But apparently the 
context menu api worked. However I've also seen reports of the context 
menu not working esp in the case of the project explorer view. This is 
generally in cases where the menu item is of type SWT.CHECK (the "Open 
With>Java Editor" is an example of such an item). Could you verify this?

Can you try something to force a selection explicitly:

node = tree.getNode("foo");
node.select().contextMenu("bar").click();

-- Ketan

On 02-Oct-08, at 5:47 PM, Curtis Wetherly wrote:

> Hi,
>
> Have a small problem that when i call click() on the context menu 
> from a
> node in my RCP's project tree i get the following exception
>
> org.eclipse.swt.SWTException: Failed to execute runnable
> (org.eclipse.swt.SWTException: Widget is disposed)
>        at org.eclipse.swt.SWT.error(SWT.java:3563)
>        at org.eclipse.swt.SWT.error(SWT.java:3481)
>        at
> org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:178)
>        at
> org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java: 
> 118)
>        at org.eclipse.swt.widgets.Display.syncExec(Display.java:4097)
>        at
> net.sf.swtbot.finder.UIThreadRunnable.run(UIThreadRunnable.java:143)
>        at
> net.sf.swtbot.finder.UIThreadRunnable.syncExec(UIThreadRunnable.java: 
> 284)
>        at
> net.sf.swtbot.widgets.AbstractSWTBot.syncExec(AbstractSWTBot.java:493)
>        at net.sf.swtbot.widgets.SWTBotMenu.isEnabled(SWTBotMenu.java: 
> 113)
>        at
> net 
> .sf.swtbot.widgets.AbstractSWTBot.assertEnabled(AbstractSWTBot.java: 
> 606)
>        at net.sf.swtbot.widgets.SWTBotMenu.click(SWTBotMenu.java:65)
>        at com.pilz.pas.pmulti.test.UITest.testNewProject(UITest.java: 
> 25)
>        ...
> Caused by: org.eclipse.swt.SWTException: Widget is disposed
>        at org.eclipse.swt.SWT.error(SWT.java:3563)
>        at org.eclipse.swt.SWT.error(SWT.java:3481)
>        at org.eclipse.swt.SWT.error(SWT.java:3452)
>        at org.eclipse.swt.widgets.Widget.error(Widget.java:432)
>        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:325)
>        at org.eclipse.swt.widgets.MenuItem.getEnabled(MenuItem.java: 
> 377)
>        at org.eclipse.swt.widgets.MenuItem.isEnabled(MenuItem.java: 
> 484)
>        at net.sf.swtbot.widgets.SWTBotMenu$3.run(SWTBotMenu.java:115)
>        at
> net.sf.swtbot.finder.UIThreadRunnable$4.doRun(UIThreadRunnable.java: 
> 282)
>        at
> net.sf.swtbot.finder.UIThreadRunnable$1.run(UIThreadRunnable.java:156)
>        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java: 
> 35)
>        ...
>
> My test code is fairly simple
>
> //Create new Project
> bot.menu("Project").menu("New").click();
> //Click ok on the new project dialog that pops up
> bot.button("OK").click();
> //Get the project tree
> SWTBotTree navTree = bot.tree(1);
> //Expand the project node
> navTree.getAllItems()[0].expand();
> //Get the POUs folder
> SWTBotTreeItem node = navTree.getAllItems()[0].getNode("POUs");
> //click the new pou menu
> node.contextMenu("New POU").click();
>
>
> It definitely finds the context menu, since the log is showing 
> finding it
> and even shows firing the click event. Maybe i'm just missing 
> something.
>
> Thanks for the help
>
> -Curtis



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's 
challenge
Build the coolest Linux based applications with Moblin SDK & win great 
prizes
Grand prize is a trip for two to an Open Source event anywhere in the 
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse



This email is intended solely for the use of the named addressee(s). Any 
unauthorised disclosure, copying or distribution of the confidential 
information contained therein, or the taking of any action based on it, is 
prohibited. The sender disclaims any liability for the integrity of this 
email. Legally binding declarations must be in written form.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to