This should go at the top of the function, before the call to `showInTree()`. There is no real harm in calling `showInTree()`, but it is not necessary since the item will be visible if it is being renamed.