Navigating to a PsiElement

How do i navigate to a certain PsiElement (PsiClass, etc).

I would like to navigate to it from a GUI dialog, so this is navigating also between selected editors.

I have no problem getting the Editor and the Document, i just have a problem finding the Navigating command in the API

Thanks
Gil

2 comments

Hi,

Try:

PsiElement navigationElement = element.getNavigationElement();
if (navigationElement != null && navigationElement instanceof Navigatable && ((Navigatable) navigationElement).canNavigate())
{
((Navigatable) navigationElement).navigate(true);
}

where element is the PsiElement you want to navigate to.

Cheers,
Robert

0

Please sign in to leave a comment.