From 8ff01473052c916bbfffbe2db574a787aaa0b13a Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 19 Jan 2015 18:15:47 +0100 Subject: [PATCH] IDEA-108519, IDEA-135363 (obtain target navigation element first) --- .../src/com/intellij/ide/actions/GotoClassAction.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java index 33163b76381f..a6c296bba9f4 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java @@ -96,8 +96,9 @@ public class GotoClassAction extends GotoActionBase implements DumbAware { AccessToken token = ReadAction.start(); try { if (element instanceof PsiElement) { - final PsiElement psiElement = getElement(((PsiElement)element), popup); - final VirtualFile file = PsiUtilCore.getVirtualFile(psiElement); + PsiElement psiElement = getElement(((PsiElement)element), popup); + psiElement = psiElement.getNavigationElement(); + VirtualFile file = PsiUtilCore.getVirtualFile(psiElement); if (file != null && popup.getLinePosition() != -1) { OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file, popup.getLinePosition(), popup.getColumnPosition()); @@ -108,7 +109,7 @@ public class GotoClassAction extends GotoActionBase implements DumbAware { } } - if (psiElement != null && file != null && popup.getMemberPattern() != null) { + if (file != null && popup.getMemberPattern() != null) { NavigationUtil.activateFileWithPsiElement(psiElement, !popup.isOpenInCurrentWindowRequested()); Navigatable member = findMember(popup.getMemberPattern(), psiElement, file); if (member != null) { @@ -186,6 +187,7 @@ public class GotoClassAction extends GotoActionBase implements DumbAware { return null; } + @NotNull private static PsiElement getElement(@NotNull PsiElement element, ChooseByNamePopup popup) { final String path = popup.getPathToAnonymous(); if (path != null) {