The Rename action that appears when a user right-clicks a notebook name on the tab section

displays the path of the current file:

I was wondering how it does that, I'd like to replicate that functionality for my extension, I've browsed through jupyterlab's source code but wasn't able to find an answer.