在Eclipse中使用SWT Bot Generator时出现空指针异常

时间:2013-10-17 05:26:19

标签: java eclipse eclipse-plugin swtbot

我试图在eclipse中使用SWT Bot生成器,但是当我说开始录制时我得到一个空指针异常,这是例外:

!ENTRY org.eclipse.ui 4 0 2013-10-17 10:44:19.659
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
    at org.eclipse.swtbot.generator.ui.RecorderDialog$4.handleCodeGenerated(RecorderDialog.java:122)
    at org.eclipse.swtbot.generator.ui.BotGeneratorEventDispatcher.dispatchCodeGenerated(BotGeneratorEventDispatcher.java:176)
    at org.eclipse.swtbot.generator.ui.BotGeneratorEventDispatcher.processRules(BotGeneratorEventDispatcher.java:131)
    at org.eclipse.swtbot.generator.ui.BotGeneratorEventDispatcher.handleEvent(BotGeneratorEventDispatcher.java:88)
    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.Decorations.closeWidget(Decorations.java:309)
    at org.eclipse.swt.widgets.Decorations.WM_CLOSE(Decorations.java:1694)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4530)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2541)
    at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2541)
    at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:498)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
    at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
    at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2546)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
    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)

它工作了一次,但它突然崩溃了,现在出现了上面提到的错误!
我也在使用 -Dorg.eclipse.swtbot.generator.enable = true 选项运行配置的参数。如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

此Eclipse错误似乎与您的错误相符:https://bugs.eclipse.org/bugs/show_bug.cgi?id=416011。该bug讨论了如何将SWTBOT与调色板小部件一起使用。

答案 1 :(得分:0)

我不确定这是否是唯一的选择,可能是我错过了什么,但最后我使用了以下回购:http://download.eclipse.org/technology/swtbot/snapshots/#sthash.zMmLuzVs.dpuf
我得到了这个:http://planet.jboss.org/post/what_s_hot_for_swtbot
这对我有用。
谢谢@ greg-449的信息,它帮助了我。 :)