From 3ef20298650f4050e8e69031517331e4e05d90d9 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 25 Feb 2013 14:52:36 +0100 Subject: [PATCH] don't select anything when implementing a method with no range or text --- .../codeInsight/hint/ImplementationViewComponent.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java index 715fd486f772..8a7bd9f7b796 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java @@ -420,6 +420,7 @@ public class ImplementationViewComponent extends JPanel { } + @Nullable public static String getNewText(PsiElement elt) { Project project = elt.getProject(); PsiFile psiFile = getContainingFile(elt); @@ -427,6 +428,10 @@ public class ImplementationViewComponent extends JPanel { final Document doc = PsiDocumentManager.getInstance(project).getDocument(psiFile); if (doc == null) return null; + if (elt.getText() == null || elt.getTextRange() == null) { + return null; + } + final ImplementationTextSelectioner implementationTextSelectioner = LanguageImplementationTextSelectioner.INSTANCE.forLanguage(elt.getLanguage()); int start = implementationTextSelectioner.getTextStartOffset(elt);