From ed4be7b24867bed36a5c7d71b3468d02ba0ba901 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 22 Apr 2009 18:26:59 +0400 Subject: [PATCH] IDEADEV-36121 --- .../plugins/intelliLang/inject/InjectLanguageAction.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java index 972a474887..7b438a3c6a 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java @@ -92,26 +92,21 @@ public class InjectLanguageAction implements IntentionAction { } if (host instanceof PsiLiteralExpression) { final PsiType type = ((PsiLiteralExpression)host).getType(); - if (type == null || !type.equalsToText("java.lang.String")) { - return null; - } + return type == null || !type.equalsToText("java.lang.String") ? null : host; } else if (host instanceof XmlAttributeValue) { final PsiElement p = host.getParent(); if (p instanceof XmlAttribute) { final String s = ((XmlAttribute)p).getName(); - if (s.equals("xmlns") || s.startsWith("xmlns:")) { - return null; - } + return s.equals("xmlns") || s.startsWith("xmlns:") ? null : host; } } else if (host instanceof XmlText) { final XmlTag tag = ((XmlText)host).getParentTag(); - if (tag == null || tag.getValue().getTextElements().length > 1 || tag.getSubTags().length > 0) { - return null; - } + return tag == null || tag.getValue().getTextElements().length > 1 || tag.getSubTags().length > 0 ? null : host; } - return host; + // unknown injection host + return null; } public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { -- 2.11.4.GIT