From 8c5ebc6acaa19c80f7337e8f13bf7e03a8577247 Mon Sep 17 00:00:00 2001 From: Artem Khvastunov Date: Thu, 8 Mar 2018 17:45:00 +0100 Subject: [PATCH] add NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY --- .../src/com/intellij/codeInsight/daemon/impl/MarkerType.java | 4 ++-- .../core-api/src/com/intellij/psi/NavigatablePsiElement.java | 3 +-- .../daemon/DefaultGutterIconNavigationHandler.java | 2 +- .../plugins/groovy/codeInsight/GroovyMarkerTypes.java | 2 +- .../com/jetbrains/python/codeInsight/PyGotoSuperHandler.java | 2 +- .../jetbrains/python/codeInsight/PyLineMarkerNavigator.java | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java index c7cc37769404..fac247ac0cdd 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/MarkerType.java @@ -270,7 +270,7 @@ public class MarkerType { MethodOrFunctionalExpressionCellRenderer renderer = new MethodOrFunctionalExpressionCellRenderer(showMethodNames); Collections.sort(overridings, renderer.getComparator()); final OverridingMethodsUpdater methodsUpdater = new OverridingMethodsUpdater(method, renderer); - PsiElementListNavigator.openTargets(e, overridings.toArray(NavigatablePsiElement.EMPTY_ARRAY), methodsUpdater.getCaption(overridings.size()), "Overriding methods of " + method.getName(), renderer, methodsUpdater); + PsiElementListNavigator.openTargets(e, overridings.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY), methodsUpdater.getCaption(overridings.size()), "Overriding methods of " + method.getName(), renderer, methodsUpdater); } private static final String SEARCHING_FOR_OVERRIDDEN_METHODS = "Searching for Overridden Methods"; @@ -351,7 +351,7 @@ public class MarkerType { if (inheritors.isEmpty()) return; final SubclassUpdater subclassUpdater = new SubclassUpdater(aClass, renderer); Collections.sort(inheritors, renderer.getComparator()); - PsiElementListNavigator.openTargets(e, inheritors.toArray(NavigatablePsiElement.EMPTY_ARRAY), subclassUpdater.getCaption(inheritors.size()), CodeInsightBundle.message("goto.implementation.findUsages.title", aClass.getName()), renderer, subclassUpdater); + PsiElementListNavigator.openTargets(e, inheritors.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY), subclassUpdater.getCaption(inheritors.size()), CodeInsightBundle.message("goto.implementation.findUsages.title", aClass.getName()), renderer, subclassUpdater); } private static class SubclassUpdater extends ListBackgroundUpdaterTask { diff --git a/platform/core-api/src/com/intellij/psi/NavigatablePsiElement.java b/platform/core-api/src/com/intellij/psi/NavigatablePsiElement.java index 14f31b111f4c..1f613a9c33b0 100644 --- a/platform/core-api/src/com/intellij/psi/NavigatablePsiElement.java +++ b/platform/core-api/src/com/intellij/psi/NavigatablePsiElement.java @@ -1,5 +1,4 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - package com.intellij.psi; import com.intellij.navigation.NavigationItem; @@ -8,5 +7,5 @@ import com.intellij.navigation.NavigationItem; * @author yole */ public interface NavigatablePsiElement extends PsiElement, NavigationItem { - NavigatablePsiElement[] EMPTY_ARRAY = new NavigatablePsiElement[0]; + NavigatablePsiElement[] EMPTY_NAVIGATABLE_ELEMENT_ARRAY = new NavigatablePsiElement[0]; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/DefaultGutterIconNavigationHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/DefaultGutterIconNavigationHandler.java index c85612741601..db23f49ffe2b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/DefaultGutterIconNavigationHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/DefaultGutterIconNavigationHandler.java @@ -29,7 +29,7 @@ public class DefaultGutterIconNavigationHandler implements @Override public void navigate(MouseEvent e, T elt) { PsiElementListNavigator.openTargets(e, - myReferences.toArray(NavigatablePsiElement.EMPTY_ARRAY), + myReferences.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY), myTitle, null, createListCellRenderer()); } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyMarkerTypes.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyMarkerTypes.java index bf9588e86e4a..764ff53c9f8f 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyMarkerTypes.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyMarkerTypes.java @@ -184,7 +184,7 @@ public class GroovyMarkerTypes { Set superMethods = collectSuperMethods(method); if (superMethods.isEmpty()) return; - PsiElementListNavigator.openTargets(e, superMethods.toArray(NavigatablePsiElement.EMPTY_ARRAY), + PsiElementListNavigator.openTargets(e, superMethods.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY), DaemonBundle.message("navigation.title.super.method", method.getName()), DaemonBundle.message("navigation.findUsages.title.super.method", method.getName()), new MethodCellRenderer(true)); diff --git a/python/src/com/jetbrains/python/codeInsight/PyGotoSuperHandler.java b/python/src/com/jetbrains/python/codeInsight/PyGotoSuperHandler.java index eeac22f27df6..696d7d81fd07 100644 --- a/python/src/com/jetbrains/python/codeInsight/PyGotoSuperHandler.java +++ b/python/src/com/jetbrains/python/codeInsight/PyGotoSuperHandler.java @@ -61,7 +61,7 @@ public class PyGotoSuperHandler implements CodeInsightActionHandler { private static void navigateOrChoose(Editor editor, Collection superElements, final String title) { if (!superElements.isEmpty()) { - NavigatablePsiElement[] superElementArray = superElements.toArray(NavigatablePsiElement.EMPTY_ARRAY); + NavigatablePsiElement[] superElementArray = superElements.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY); if (superElementArray.length == 1) { superElementArray[0].navigate(true); } diff --git a/python/src/com/jetbrains/python/codeInsight/PyLineMarkerNavigator.java b/python/src/com/jetbrains/python/codeInsight/PyLineMarkerNavigator.java index 236c85148703..d25868cdcc81 100644 --- a/python/src/com/jetbrains/python/codeInsight/PyLineMarkerNavigator.java +++ b/python/src/com/jetbrains/python/codeInsight/PyLineMarkerNavigator.java @@ -44,7 +44,7 @@ abstract class PyLineMarkerNavigator implements GutterIcon * {@link PsiElementListNavigator} simply opens then (hence it is swing-based) and can't be used in tests. * So, in unit tests we save data in element and data could be obtained with {@link #getNavigationTargets(UserDataHolder)} */ - final NavigatablePsiElement[] methods = navElements.toArray(NavigatablePsiElement.EMPTY_ARRAY); + final NavigatablePsiElement[] methods = navElements.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY); if (ApplicationManager.getApplication().isUnitTestMode()) { elt.putUserData(MARKERS, methods); }