How to get the uri of the selected folder

When I click the custom button, how can I get the Uri of the selected folder in the current workspace?
image
I have selected the aabbcc folder, how can I get the Uri of the folder I selected?

Hi @Xotm,

kind of depends, if you just need to run a command from the context menu, we automatically pass the URI of the currently selected file to the command. However, for every other case you will probably need to get access to the underlying TreeModel of the navigator widget and use the getFocusedNode() method to get the focused tree node. That contains the URI of the selected element.

hello,how do I get the URI of the first level directory,like this

I get the URI of the workspace and then use the workspace URI to get all the subfiles under this URI.Hope it can help you.

Thank you. My problem is solved.