1

我有以下代码:

        TableViewer tv = new TableViewer(attributeTable);
        tv.setContentProvider(new BOAttributeTableContentProvider());
        tv.setLabelProvider(new BOAttributeTableLabelProvider());

在设置标签提供程序时我得到的位置AssertionFailedError。谁能告诉我我在这里做错了什么?或者在哪种情况下会引发此错误?

错误日志:

org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
    at org.eclipse.jface.util.Assert.isNotNull(Assert.java:150)
    at org.eclipse.jface.util.Assert.isNotNull(Assert.java:126)
    at org.eclipse.jface.viewers.StructuredViewer.disassociate(StructuredViewer.java:615)
    at org.eclipse.jface.viewers.TableViewer.internalRefreshAll(TableViewer.java:904)
    at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:818)
    at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:807)
    at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1388)
    at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1323)
    at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1386)
    at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1345)
    at org.eclipse.jface.viewers.ContentViewer.setLabelProvider(ContentViewer.java:281)
    at org.eclipse.jface.viewers.StructuredViewer.setLabelProvider(StructuredViewer.java:2003)
    at org.eclipse.jface.viewers.TableViewer.setLabelProvider(TableViewer.java:1086)
    at com.misys.bankfusion.bpdesigner.boeditor.pages.BOAttributesPage.populateAttributeTableContents(BOAttributesPage.java:458)
    at com.misys.bankfusion.bpdesigner.boeditor.pages.BOAttributesPage.access$000(BOAttributesPage.java:128)
    at com.misys.bankfusion.bpdesigner.boeditor.pages.BOAttributesPage$1.setToModel(BOAttributesPage.java:341)
    at com.trapedza.bankfusion.editor.AbstractEditorDelegate.updateData(AbstractEditorDelegate.java:173)
    at com.trapedza.bankfusion.editor.AbstractEditorDelegate$1.dialogFieldChanged(AbstractEditorDelegate.java:181)
    at com.trapedza.bankfusion.utils.dialogs.internal.DialogField.dialogFieldChanged(DialogField.java:132)
    at com.trapedza.bankfusion.utils.dialogs.internal.ListBoxDialogField.doModifySelection(ListBoxDialogField.java:51)
    at com.trapedza.bankfusion.utils.dialogs.internal.ComboDialogField$2.widgetSelected(ComboDialogField.java:153)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    at org.eclipse.core.launcher.Main.run(Main.java:977)
    at org.eclipse.core.launcher.Main.main(Main.java:952)
4

4 回答 4

2

确保方法名称开头的“test”是小写的。如果您说 TestMethod,您将收到此错误消息。你应该说testMethod。

例如:

@Test
    public void test_VPlugin() throws Exception {

这对我有用,我希望它对你有用

于 2011-04-20T08:51:50.420 回答
0

您正在使用 ( TableViewer) 或两个 setter ( setContentProvider, ) 的构造函数具有引发这些异常的setLabelProvider保护语句。assert代码的作者有一个想法,即保护其代码免受您在调用她/他的代码时使用的不规则参数的影响。

于 2010-06-21T12:11:38.597 回答
0

堆栈跟踪显示,您从'BOAttributesPage.populateAttributeTableContents()'调用'TableViewer.setLabelProvider() '最终导致调用'org.eclipse.jface.viewers.StructuredViewer.disassociate() ' 参数为且该方法约束输入参数不为

于 2010-06-21T12:27:24.323 回答
0

看起来 BOAttributeTableContentProvider 在某处沿线提供了一个空对象(您尝试在表中显示的元素之一为空)。调试内容提供者。希望我迟到的回答会有所帮助。

于 2010-08-21T20:58:24.003 回答