diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IterateOverIterableIntention.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IterateOverIterableIntention.java index 11c66b4280ca..9806eb67fc6b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IterateOverIterableIntention.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/IterateOverIterableIntention.java @@ -39,7 +39,7 @@ public class IterateOverIterableIntention implements IntentionAction { @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { - final TemplateImpl template = getTemplate(); + final TemplateImpl template = file instanceof PsiJavaFile ? getTemplate() : null; if (template != null) { int offset = editor.getCaretModel().getOffset(); int startOffset = offset;