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

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 =[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:

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(
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.handleShow(
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.safeHandleEvent(
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.access$1(
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter$
at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRendererFilter.handleEvent(
at org.eclipse.swt.widgets.EventTable.sendEvent(
at org.eclipse.swt.widgets.Display.filterEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Widget.notifyListeners(
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.findMenusInternal(
at org.eclipse.swtbot.swt.finder.finders.MenuFinder.access$0(
at org.eclipse.swtbot.swt.finder.finders.MenuFinder$
at org.eclipse.swtbot.swt.finder.finders.MenuFinder$
at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$2.doRun(
at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(
at org.eclipse.swt.widgets.Display.runAsyncMessages(
at org.eclipse.swt.widgets.Display.readAndDispatch(
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$
at org.eclipse.core.databinding.observable.Realm.runWithDefault(
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(
at org.eclipse.ui.internal.Workbench$
at org.eclipse.core.databinding.observable.Realm.runWithDefault(
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
at org.eclipse.ui.internal.ide.application.IDEApplication.start(
at org.eclipse.swtbot.eclipse.core.UITestApplication.start(
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
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(
at org.eclipse.equinox.launcher.Main.basicRun(
at org.eclipse.equinox.launcher.Main.main(
Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument:Action must not be null
at org.eclipse.core.runtime.Assert.isNotNull(
at org.eclipse.jface.action.ContributionManager.add(
at org.eclipse.debug.internal.ui.views.variables.VariablesView.fillContextMenu(
at org.eclipse.debug.ui.AbstractDebugView$2.menuAboutToShow(
at org.eclipse.jface.action.MenuManager.fireAboutToShow(
at org.eclipse.jface.action.MenuManager.handleAboutToShow(
... 49 more

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

Thanks in advance,
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, away until January 8th is currently offline Mickael Istria, away until January 8thFriend
Messages: 828
Registered: July 2009
Location: Grenoble, France
Senior Member


It seems to me that the issue you describe is the one that was reported
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:

Mickael Istria
JBoss, by Red Hat
My blog:
My Tweets:
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: Mon May 21 13:21:12 GMT 2018

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

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

Back to the top