tags:

views:

101

answers:

2

This piece of code (in Scala)

val contents = {
  assert(mainWindow.detailsPane != null)
  new Composite(mainWindow.detailsPane, SWT.NONE)
}

throws an exception:

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)

According to the documentation, IllegalArgumentException should only be thrown when the parent is null, but I am checking for that. detailsPane is a CTabFolder. Can anybody say why this could happen?

+1  A: 

Solution given at the Eclipse forums: detailsPane turned out to be disposed.

Alexey Romanov
+1  A: 

Did you check if the widget is disposed?

EDIT: did not see you answer there ;)

drstupid