Navigate among files in a project
Answered
Hi,
Is there an API in IDEA to navigate within files in the same project. As an example I can get the PsiFile/ virtual file which I want to open in a new editor view. But how can I open that file in a new editor view and navigate the user tot hat newly opened editor view?
Please sign in to leave a comment.
Hello Sajith,
to navigate from a symbol in code (e.g. symbol which points to a file), you can resolve symbol to that file. Then you can navigate to file by ctrl click
PsiFile subclasses PsiElement.
Hi Imants,
I want to navigate the user to that file opened in a new editor view, programatically. Further, I want the user to be navigated when a button is clicked, rather than clicked on a symbol in editor view (I have written a custom editor provider and it will show the button in the editor view)
this might work (not tested):
EditorFactory.getInstance().createEditor(...)
PsiFile extends Navigatable interface, so it has 'navigate' method, which should do what you need.
Hi Dimitry,
It worked like a charm. Thank you.