diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java index 4fdcb55f16e5..3a249dfb557c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java @@ -81,10 +81,14 @@ public class GotoImplementationHandler extends GotoTargetHandler { @Override public void run(@NotNull ProgressIndicator indicator) { super.run(indicator); + for (PsiElement element : myGotoData.targets) { + updateComponent(element, createComparator(renderers, myGotoData)); + } new ImplementationSearcher.BackgroundableImplementationSearcher() { protected void processElement(PsiElement element) { - myGotoData.addTarget(element); - updateComponent(element, createComparator(renderers, myGotoData)); + if (myGotoData.addTarget(element)) { + updateComponent(element, createComparator(renderers, myGotoData)); + } } }.searchImplementations(myEditor, myGotoData.source, myOffset); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoTargetHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoTargetHandler.java index 21dba52df62e..8491b40d6beb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoTargetHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoTargetHandler.java @@ -278,7 +278,8 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler { return hasDifferentNames; } - public void addTarget(final PsiElement element) { + public boolean addTarget(final PsiElement element) { + if (ArrayUtil.find(targets, element) > -1) return false; targets = ArrayUtil.append(targets, element); renderers.put(element, createRenderer(this, element)); if (!hasDifferentNames && element instanceof PsiNamedElement) { @@ -291,6 +292,7 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler { myNames.add(name); hasDifferentNames = myNames.size() > 1; } + return true; } public PsiElementListCellRenderer getRenderer(Object value) {