From ebc92ac64014ed6c81665429060f8bf4c58575d3 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Fri, 1 Jul 2016 14:50:24 +0300 Subject: [PATCH] navigation: don't show notification that nothing was found after cancel of the modal progress (IDEA-157671) --- .../intellij/codeInsight/navigation/CtrlMouseHandler.java | 3 +++ .../codeInsight/navigation/GotoImplementationHandler.java | 1 + .../codeInsight/navigation/ImplementationSearcher.java | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java index 481f6e695c79..4167929579ee 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java @@ -571,6 +571,9 @@ public class CtrlMouseHandler extends AbstractProjectComponent { return PsiUtilCore.toPsiElementArray(found); } }.searchImplementations(editor, element, offset); + if (targetElements == null) { + return null; + } if (targetElements.length > 1) { PsiElement elementAtPointer = file.findElementAt(offset); if (elementAtPointer != null) { 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 a1e6110dc13f..a747623b4ef7 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/GotoImplementationHandler.java @@ -61,6 +61,7 @@ public class GotoImplementationHandler extends GotoTargetHandler { return false; } }.searchImplementations(editor, source, offset); + if (targets == null) return null; GotoData gotoData = new GotoData(source, targets, Collections.emptyList()); gotoData.listUpdaterTask = new ImplementationsUpdaterTask(gotoData, editor, offset, reference); return gotoData; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/ImplementationSearcher.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/ImplementationSearcher.java index ef735a2285d8..c2cb9fc29874 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/ImplementationSearcher.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/ImplementationSearcher.java @@ -40,7 +40,7 @@ public class ImplementationSearcher { public static final String SEARCHING_FOR_IMPLEMENTATIONS = CodeInsightBundle.message("searching.for.implementations"); - @NotNull + @Nullable PsiElement[] searchImplementations(final Editor editor, final PsiElement element, final int offset) { final TargetElementUtil targetElementUtil = TargetElementUtil.getInstance(); boolean onRef = ApplicationManager.getApplication().runReadAction(new Computable() { @@ -57,14 +57,14 @@ public class ImplementationSearcher { }), onRef); } - @NotNull + @Nullable public PsiElement[] searchImplementations(final PsiElement element, final Editor editor, final int offset, final boolean includeSelfAlways, final boolean includeSelfIfNoOthers) { if (element == null) return PsiElement.EMPTY_ARRAY; final PsiElement[] elements = searchDefinitions(element, editor); - if (elements == null) return PsiElement.EMPTY_ARRAY; //the search has been cancelled + if (elements == null) return null; //the search has been cancelled if (elements.length > 0) { if (!includeSelfAlways) return filterElements(element, elements, offset); final PsiElement[] all;