Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Eclipse Juno & SWTBot : Clicking on a Context menu of tree Item throws exception
Eclipse Juno & SWTBot : Clicking on a Context menu of tree Item throws exception [message #1007220] Tue, 05 February 2013 06:09 Go to next message
Syamananda Singh is currently offline Syamananda SinghFriend
Messages: 4
Registered: September 2012
Junior Member
Hi,

I'm using Eclipse 4.2 with SWTBot 2.0.5 for testing my application.
On trying to click on a tree item specific context menu in a view, it's throwing java.lang.reflect.InvocationTargetException.

Not all context menu of view throws the exception but only those context menu which gets enabled only after selecting the tree item.

Before testing, i made sure that the tree item is present in the view and selected.

Below is my code:

NOTE: The below lines of code works fine in Eclipse Indigo

// At this point, the active view returned is Variable view
SWTBotView activeView = bot.activeView();
// At this point, Variable View has the variable already loaded and it's selected
SWTBotTreeItem item = view.bot().tree().getAllItems()[0].select();
// We try to click context menu 'Change Value...'
// which are enabled after selecting tree item
item.contextMenu("Change Value...").click();


At the above last line, below is the exception that is being thrown:

java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.showMenu(MenuManagerRendererFilter.java:253)
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.handleShow(MenuManagerRendererFilter.java:225)
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.safeHandleEvent(MenuManagerRendererFilter.java:207)
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.access$1(MenuManagerRendererFilter.java:143)
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter$SafeWrapper.run(MenuManagerRendererFilter.java:130)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.handleEvent(MenuManagerRendererFilter.java:140)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.findMenusInternal(MenuFinder.java:152)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.access$0(MenuFinder.java:149)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder$2.run(MenuFinder.java:124)
at org.eclipse.swtbot.swt.finder.finders.MenuFinder$2.run(MenuFinder.java:1)
at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$2.doRun(UIThreadRunnable.java:140)
at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$1.run(UIThreadRunnable.java:89)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
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:75)
at org.eclipse.debug.internal.ui.views.variables.VariablesView.fillContextMenu(VariablesView.java:1074)
at org.eclipse.debug.ui.AbstractDebugView$2.menuAboutToShow(AbstractDebugView.java:537)
at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:342)
at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:473)
... 49 more


Please let me know if there is any way i can fix it or of any workaround.

Thanks in advance,
Syam
Re: Eclipse Juno & SWTBot : Clicking on a Context menu of tree Item throws exception [message #1007324 is a reply to message #1007220] Tue, 05 February 2013 14:34 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Hi,

It seems to me that the issue you describe is the one that was reported
here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=384621
Fortunately, it is already fixed and the fix will be part of next SWTBot
release. In the meantime, you can use the SNAPSHOTS of SWTBot which
already contain this fix:
http://wiki.eclipse.org/SWTBot#Latest_snapshot_build

--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:How enable and disable buttons using event in SWT.
Next Topic:Getting the text from composite in eclipse using the SWTbot API
Goto Forum:
  


Current Time: Thu Apr 25 17:54:58 GMT 2024

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

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

Back to the top