boolean (@NotNull PsiElement element, @NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext context) { final int offset = TargetElementUtil.adjustOffset(file, editor.getDocument(), editor.getCaretModel().getOffset()); final PsiElement psiElement = file.findElementAt(offset); final PsiReferenceParameterList referenceParameterList = PsiTreeUtil.getParentOfType(psiElement, PsiReferenceParameterList.class); if (referenceParameterList != null) { return referenceParameterList.getTypeArguments().length > 0; } if (psiElement instanceof PsiIdentifier) { PsiElement parent = psiElement.getParent(); if (parent instanceof PsiVariable || parent instanceof PsiMethod method && !method.isConstructor()) { return true; } } return PsiTreeUtil.getParentOfType(psiElement, PsiTypeElement.class) != null; }