这段代码(在Scala中)
val contents = {
assert(mainWindow.detailsPane != null)
new Composite(mainWindow.detailsPane, SWT.NONE)
}
抛出异常:
Exception occurred
java.lang.IllegalArgumentException: Argument not valid
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.SWT.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.error(Unknown Source)
at org.eclipse.swt.widgets.Widget.checkParent(Unknown Source)
at org.eclipse.swt.widgets.Widget.<init>(Unknown Source)
at org.eclipse.swt.widgets.Control.<init>(Unknown Source)
at org.eclipse.swt.widgets.Scrollable.<init>(Unknown Source)
at org.eclipse.swt.widgets.Composite.<init>(Unknown Source)
at main.scala.NodeViewPresenter$NodeViewImpl.<init>(NodeViewPresenter.scala:41)
根据documentation,IllegalArgumentException
只应在父级为null
时抛出,但我正在检查它。 detailsPane
是CTabFolder
。为什么会发生这种情况?
答案 0 :(得分:2)
给出at the Eclipse forums的解决方案:detailsPane
原来被处理掉了。
答案 1 :(得分:1)
您是否检查过小部件是否已被处理?
编辑:没有看到你回答;)