Can you try below
Code:
RegisterUserFunc "JavaTree","Expand","Expand"
Function Expand(Object, nodeouter)
For i=1 To (Object.GetItemsCount) step 1
nodeinner=Object.GetItem(i)
If nodeouter = nodeinner Then
Object.Expand(i)
End If
Next
End Function
JavaWindow("MyWorkListWindow").JavaTree("MyWorkListTree").Expand(nodename)