boolean (@NotNull TemplateActionContext templateActionContext) { PsiFile file = templateActionContext.getFile(); int startOffset = templateActionContext.getStartOffset(); if (PsiUtilCore.getLanguageAtOffset(file, startOffset).isKindOf(JavaLanguage.INSTANCE)) { PsiElement element = file.findElementAt(startOffset); if (element instanceof PsiWhiteSpace) { return false; } return element != null && isInContext(element); } return false; }