boolean (PsiElement element) { if (!(element instanceof PsiJavaToken javaToken)) { return false; } final IElementType tokenType = javaToken.getTokenType(); if (!JavaTokenType.TRY_KEYWORD.equals(tokenType)) { return false; } final PsiElement parent = element.getParent(); if (!(parent instanceof PsiTryStatement tryStatement)) { return false; } if (tryStatement.getTryBlock() == null) { return false; } final PsiResourceList resourceList = tryStatement.getResourceList(); return resourceList != null; }