From ba9f665d2b3f321c1099df383de578b329b109c8 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 21 Jan 2014 13:13:49 +0400 Subject: [PATCH] IDEA-72304 Namespace auto import does not work for EL functions --- .../impl/analysis/CreateNSDeclarationIntentionFix.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/CreateNSDeclarationIntentionFix.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/CreateNSDeclarationIntentionFix.java index 2f61dd47f83c..88d639a09127 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/CreateNSDeclarationIntentionFix.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/CreateNSDeclarationIntentionFix.java @@ -206,9 +206,11 @@ public class CreateNSDeclarationIntentionFix implements HintAction, LocalQuickFi @Override public boolean showHint(@NotNull final Editor editor) { - if (myToken == null) return false; - XmlToken token = (XmlToken)myToken.retrieve(); - if (token == null) return false; + XmlToken token = null; + if (myToken != null) { + token = (XmlToken)myToken.retrieve(); + if (token == null) return false; + } if (!XmlSettings.getInstance().SHOW_XML_ADD_IMPORT_HINTS || myNamespacePrefix.isEmpty()) { return false; } @@ -219,7 +221,7 @@ public class CreateNSDeclarationIntentionFix implements HintAction, LocalQuickFi final String message = ShowAutoImportPass.getMessage(namespaces.size() > 1, namespaces.iterator().next()); final String title = getTitle(); final ImportNSAction action = new ImportNSAction(namespaces, getFile(), element, editor, title); - if (element instanceof XmlTag) { + if (element instanceof XmlTag && token != null) { if (VisibleHighlightingPassFactory.calculateVisibleRange(editor).contains(token.getTextRange())) { HintManager.getInstance().showQuestionHint(editor, message, token.getTextOffset(),