boolean (PsiElement element) { final PsiElement parent = element.getParent(); if (!(parent instanceof PsiJavaCodeReferenceElement)) { return false; } if (((PsiJavaCodeReferenceElement)parent).isQualified()) { return false; } PsiElement grandParent = parent.getParent(); if (grandParent instanceof PsiMethodCallExpression || grandParent instanceof PsiReferenceList) { return false; } if (grandParent instanceof PsiTypeElement) { PsiElement greatGrandParent = grandParent.getParent(); if (greatGrandParent instanceof PsiMember || greatGrandParent instanceof PsiReferenceParameterList || greatGrandParent instanceof PsiRecordHeader || greatGrandParent instanceof PsiJavaFile) { return false; } } if (JavaKeywordCompletion.isInsideParameterList(element)) { return false; } return !isAfterExpression(element); }