Get PsiElement by file name

I have file name, only name not path. File is xml.
I want to provide GotoRelatedItem for it and it requires PsiElement.
How can I get PsiElemnt by file name?

1 comment
Comment actions Permalink

You can use the FilenameIndex class to find all files in a project that have a given name. Note that it can return multiple files, and it's up to you to find the right one.

0

Please sign in to leave a comment.