This moves a fiddly little bit of logic used by a few UI classes into a central location. Also means that the paths dialog learns to expand the first cell when it needs to (like the text variable panel).