Automaticly open treeview

If current document does not have children, get parent and open it.